Html :
<
textarea
name
=
"info"
>
</
textarea
>
<br/>
<input type="button" id="clearlogs" value="Clear Logs"/>
<div id="log"></div>
Script:
$
(
function
(
)
{
$("[name=info]").bind("keydown",callFunc1).bind("keyup",callFunc2);
$("#clearlogs").on('click',function(){
$("#log").empty();
})
});
function callFunc1(ev){
if (ev.keyCode == "13" && !ev.shiftKey){
$("#log").empty();
$("#log").prepend("calling enter key <br/>");
ev.preventDefault();
return;
}
$("#log").prepend("calling keydown <br/>");
}
function callFunc2(e){
$("#log").prepend("calling keyup <br/>");
}
In above code i have using two events (keydown, keyup) in the textarea. In keydown event calling callFunc1 and keyup event calling callFunc2 functions.
In keydown function if the enter key pressed then callFunc2 will not execute my scenario, but executing the callFunc2 function is executing.
Please help to avoid calling the callFunc2 function.
Thanks,
Kumaresan