开发者

jquery typeWatch with Dynamic input fields added on the fly

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜