What am I missing here?
Please note: jQuery MOBILE is used
If I use preventDefault the page loads as if I had just links and no script, when I change to return false (which I always used to use on the plain JS onclick event handler), it works as expected.
I have already looked through other posts and all use .click and all suggest preventDefault.
$(document).ready(function() {
$("#leftdiv a").on("click",function(e) {
$("#rightDiv").load(this.href);
return false; // I was sure preventDefault would work
});
});
HTML
<div id="leftdiv" style="position:absolute;padding-right:5%; overflow:scroll;">
<a href="page1.htm">Launch page 1</a><br />
<a href="page2.htm">Launch page 2</a>
</div>
<div id="rightDiv" style="padding-left:30%"></div>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…