I know that you can add new jQuery functions by $.fn.someFunction = function()
However, I want to add functions to specific elements only. I tried this
I'm not also sure with my answer if this will help you but just a try how about using .live?
$(selector).live(click,function(){
//some codes here
});
Use .bind() and .trigger()
$('button').bind('someFunction',function() {
alert('go away!')
});
$('button').click(function(){
$(this).trigger('someFunction');
});
As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document.
I did this and its working fine..
function do_write(){
$("#script").append("<script> $(\'#t"+(id_app+4)+"\').change(function(){ alert('Write Your Code here'); });<\/script>");
console.log("<script> $(\'#t"+(id_app+4)+"\').change(function(){ alert('hello'); });<\/script>");
}
and call function from your dynamic function which is creating a dynamic control in html