1
I am set some similar functions for different pages on a website. So these functions are in the same file. When the JS file is loaded the functions $(function() { /*function1*/ });
and $(function() { /*function2*/ });
are executed. However, the elements which I pick up via jQuery (Ex.: $('.elem').val();
) will not exist as they are on another page.
How do I execute a function only when a determining element is loaded?
could post the command calling these functions?
– Jader A. Wagner
There are different ways depending on how elements are added. You can clarify how they "appear" on that page
$('.elem')
?– Sergio