I would like to call a function from the jQuery Click event. I tried the annotation below which doesn't work.
$(".menu_link").click(GetContentAndSlide());
What is the right annotation?
$("document"). ready(function() { setTimeout(function() { $("ul. galleria li:first-child img"). trigger('click'); },10); });
$() = window. jQuery() $()/jQuery() is a selector function that selects DOM elements. Most of the time you will need to start with $() function. It is advisable to use jQuery after DOM is loaded fully.
$(".menu_link").click(GetContentAndSlide);
remove the (), you are executing the function, instead of passing the function reference.
Another option would be (in case your function uses the this pointer) to wrap it around with a anonymous function:
$(".menu_link").click(function() {GetContentAndSlide()});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With