jQuery debounce, way to pass the element along to the function? -


html

<input class="list_item_title mini" name="list_item[title]" size="30" type="text" value="what happens when user creates new item?"> 

js:

function text_2(e) {     console.log(e.val()); };  $(function() {     $('input.list_item_title').keyup( $.debounce( 250, text_2 ) ); }); 

e.val() doesn't work. how can pass input along can value?

thanks

e reference event object [docs], not input element.

you can reference input element using event.currenttarget [docs].

after having @ source code, should able access element this (like in other event handler), following should work:

function text_2(e) {     console.log($(this).val()); }; 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -