Can you extend the val() function in jQuery? -
is there way extend val() function in jquery.
basically, want set class variable if there content being dynamically entered input.
whick like
var thisval = 'hello world'; $('#myinput').val(thisval).addclass('dark');
it nice tell val() function add class 'dark' input if there value, , remove if empty.
possible?
try
$.fn.xval = function () { return this.toggleclass(arguments.length).val.apply(this, arguments); };
Comments
Post a Comment