press b key or enter key
example code:-
<textarea id="fb"></textarea>
<h5>press b key or enter key</h1>
<div id="this" width="300px" height="100px" style="background-color:red;"></div>
<script>
$("textarea").keyup(function(e){
var code = e.keyCode || e.which;
if (code == 13) {
$("#this").append("you press enter key ");
$("#this").append(code + " ");
}
if (code == 66) {
$("#this").append("you press b key ");
$("#this").append(code + " ");
}
});
</script>
<h5>press b key or enter key</h1>
<div id="this" width="300px" height="100px" style="background-color:red;"></div>
<script>
$("textarea").keyup(function(e){
var code = e.keyCode || e.which;
if (code == 13) {
$("#this").append("you press enter key ");
$("#this").append(code + " ");
}
if (code == 66) {
$("#this").append("you press b key ");
$("#this").append(code + " ");
}
});
</script>
No comments:
Post a Comment