开发者

Double click needed in firefox (JQUERY)

I was advised to used this because i was having a problem, a link worked in FireFox ONLY when clicked the second time. This is to display an external html in a div called leftColumn.

$(function(){
  $('#ulWithAllTheLinks').delegate('li a', 'click', function(e){
     e.preventDefault;
     $('#leftColumn').load(this.href);
  });
});

My question is, that this displays the html with the content in a NEW page, I know that it has something to do with this:

<ul id="one">
  <li><a href="content.html">First Link</a开发者_StackOverflow社区></li>
</ul>

yet i don't know how to link this to the function


event.preventDefault() is a function, so you need parenthesis on the end, like this:

$(function(){
  $('#ulWithAllTheLinks').delegate('li a', 'click', function(e){
     e.preventDefault();
     $('#leftColumn').load(this.href);
  });
});

Without the .preventDefault() (or return false;) working correctly, the default behavior will occur...going to that page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜