Function current_child
will execute without html li.first
is being clicked becouse of a param. How could i send a param like event.target
to current_child when its clicked. At the moment it executes when page is being loaded. Skipping the param like $(document).on("click", "li.first", current_child)
and the function will wait to be executed untill the html object is being clicked.
var toggle = false;
function current_child(value){
if(value == 1){
alert("Hello");
}
event.preventDefault();
}
$(document).on("click", "li.first", current_child(1));