views:

176

answers:

1

How can i get the Id of the input field 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

A: 

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

patrickmcgraw