validation - jQuery to trim() a text input field's value attribute? -



validation - jQuery to trim() a text input field's value attribute? -

in jqeury, i'm able bind paste event validate form field, method within function apparently wrong. i'm not getting alert @ all.

i want trim text that's input , homecoming value of form input text field #adsense_client_id.

$("#adsense_client_id").bind('paste', function(e) { $(this).attr('value') = $.trim(this).val(); alert($(this).val()); //why no alert? });

the $.trim function needs variable/string within it, since did not wrap $(this).val() $.trim in order work.

as need timeout paste caught, this:

$("#adsense_client_id").bind('paste', function(e) { var clientid = $(this); settimeout(function(){ clientid.val($.trim(clientid.val())); alert(clientid.val()); }); });

demo.

jquery validation

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -