Tuesday 13 November 2018

JQuery event in javascript object



I have a javascript object



function A()
{
this.ini = function()
{

$('#test').html('');
}

$('#click').on('click',function(){
alert('Hi');
});
}


http://jsfiddle.net/G2MUE/1/




But I have a problem, the event onClick is not used.



Thanks for your help


Answer



function A()
{
this.ini = function()
{
$('#test').html('');

}

$(document).on('click', '#click', function(){
alert('Hi');
});
}


http://jsfiddle.net/G2MUE/7/


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...