开发者

jquery typeWatch with Dynamic input fields added on the fly

开发者 https://www.devze.com 2022-12-23 09:58 出处:网络
How can i get theId of theinput fie开发者_JAVA技巧ld added on the fly? My script adds the input fields on click on the button , using

How can i get the Id of the input fie开发者_JAVA技巧ld added on the fly? My script adds the input fields on click on the button , using

var ix = 1;
$(template2(ix++)).appendTo("#dataTable tbody");
var template2 = jQuery.format($("#template2").val()); 

I also add this , line after the insertion of the new fields, so it adds the typeWatch to all the .email class fields.

$(".email").typeWatch( { highlight:true, callback:function(){alert("changed search text"); },  wait:750  } );

now, in the callback function , I want to get the Id of the input field typeWatch Callback is triggered.

Please advice.

Thanks


In the callback function it looks like this.el contains a DOM object for the element that triggered the callback. So,

$(this.el).attr('id')

should get you the id you're looking for. This is under version 2.0.0 of the plug-in

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号