I am using this function to load a page into a div
$(function() {
$('a[href=myurl]').click(function() {
$('#loadHere').load('myurl');
return false;
});
});
This is working fine
I am testing this code for more than one link, which finds the class attribute InPage:
$('a.InPage').click(function() {
$('#loadHere').load( $(this).attr('href') );
return false;
});
In my test page:
http://www.tremyfoel.co.uk/jqueryTest2.htm
But for some reason not apparent to me in spite of persistent efforts/tinkering doesn’t work. Logic & syntax seems fine, jsFiddle doesn’t flag any error, I’ve tried different jQuery versions (for some reason 1.4.0 is whats required). Any advice appreciated.
Change
to
You need to wrap your other script in the same
$(function() {document ready code that the working code exists in. Otherwise the browser attempts to run it before the element has been loaded.