Response title
This is preview!
<textarea name="info"></textarea>
<br/>
<input type="button" id="clearlogs" value="Clear Logs"/>
<div id="log"></div>
$(function(){
$("[name=info]").bind("keydown",callFunc1).bind("keyup",callFunc2);
$("#clearlogs").on('click',function(){
$("#log").empty();
})
});
function callFunc1(ev){
if (ev.keyCode == "13" && !ev.shiftKey){//pressing enter key
$("#log").empty();
$("#log").prepend("calling enter key <br/>");
ev.preventDefault();
return;
}
$("#log").prepend("calling keydown <br/>");
}
function callFunc2(e){
$("#log").prepend("calling keyup <br/>");
}
<input type="text" name="firstName" id="firstName" /><script>console.log(jQuery("[name=firstName]"));</script>
<input type="text" name="First Name" id="First Name" /><script>console.log(jQuery("[name=First Name]"));</script>
<input type="text" name="firstName" id="firstName" /><script>console.log(jQuery("[name=firstName]"));</script>
<input type="text" name="First Name" id="First Name" /><script>console.log(jQuery("[name=First Name]"));// not working.console.log(jQuery("[name='First Name']"));// working fine.</script>
var qXHR = jQuery.ajax({url:url,cache: false,type:"POST",data:args});
qXHR.onreadystatechange = function() {
if(qXHR.readyState == 3){
//do some thing
}
else if(qXHR.readyState == 4){
//do some thing
}
}
<input type="text" name="firstName" id="firstName" /><script>console.log(jQuery("[name=firstName]"));</script>
<input type="text" name="First Name" id="First Name" /><script>console.log(jQuery("[name=First Name]"));</script>
<input type="text" name="firstName" id="firstName" /><script>console.log(jQuery("[name=firstName]"));</script>
<input type="text" name="First Name" id="First Name" /><script>console.log(jQuery("[name=First Name]"));// not working.console.log(jQuery("[name='First Name']"));// working fine.</script>
var qXHR = jQuery.ajax({url:url,cache: false,type:"POST",data:args});
qXHR.onreadystatechange = function() {
if(qXHR.readyState == 3){
//do some thing
}
else if(qXHR.readyState == 4){
//do some thing
}
}
Type 2function myFunc(args){// do sumthing}
myFunc = function(args){// do sumthing}
© 2013 jQuery Foundation
Sponsored by and others.