Exist any event in jQuery that attach an event like this:
$("body").on("click", "#test", function () {
// some code here...
});
That I can attach to load
or ready
event, to replace the:
$(document).ready(function () {
// Some code...
});
I need this because I have the $(document).ready();
scope in an external file, that do some form validation, and in my HTML I load some content by ajax, and then all is in that scope don't work.
In other words, I want that all in the $(document).ready();
stay live
on the page, using something like .on
.
If I put the HTML directly in the page, without ajax, the validation works.
Any idea on how I can solve this problem?