I want to extend the functionality of my textarea element. The textarea elements should respond when I call a method like this:
$('#jsedit').jsedit();
I know it can be done by doing like this:
$(function() {
$.fn.extend({
jsedit: function() {
alert(this.val());
}
});
});
but how can I specify only the textarea can do this? Because now every element can called jsedit() method.
Like this:
$(function() {
$.fn.extend({
jsedit: function() {
if ($(this).is('textarea')) {
//your stuff
}
}
});
});
console.log($('#your_textarea').jsedit());
EDIT: complete statement
lg,
flo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With