I want to apply/bind event only on specific DIV ID
and Textarea
. Then How can I achieve this?
I have below code
jQuery("#dataContent").bind("click change keypress"....){
.....
}
I want to apply above three events only on Textarea
and not on other HTML elements. Then How can I achieve this?
Can I do like below?
jQuery("#dataContent textarea")
Because currently above three events creating issue with file input
and checkbox
.
Any help would be heartily appreciated :)
Note: I'm facing this issue since long and not able to resolve it till today :(
Yes you can like,
$("#dataContent textarea").on("click, change, keypress", function() {
});
OR
$("#dataContent").on("click, change, keypress","textarea", function() {
});
You can use it like
$( "#dataContent textarea" ).on({
click: function() {
alert("click");
}, change: function() {
alert("change");
}, keypress: function() {
alert("keypress");
}
});
Read on()
$("#dataContent ")
.on("click, change, keypress","textarea", function() {
});
reference .on
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.