JQuery Bind klik
$( "#foo" ).bind( "click", function() {
alert( "User clicked on 'foo.'" );
});
Sticky Pingu
$( "#foo" ).bind( "click", function() {
alert( "User clicked on 'foo.'" );
});
// bind click handler to element that is added later/dynamically
document.addEventListener('click', function(e){
if(e.target && e.target.id== 'myDynamicallyAddedElementID'){
//do something
}
});
//Alternatively, if your using jQuery:
$(document).on('click','#myDynamicallyAddedElementID',function(){
//do something
});
hello hi how are you
var someEventHander=function(event,param1,param2){
console.log(event,param1,param2);
}
//add listener
document.getElementById("someid").addEventListener('click',someEventHander.bind(event,'param1','param2'), false);