admin管理员组文章数量:1279234
I have an anchor that triggers a javascript which uses jquery:
<a href="javascript: $('#dash-main').load('billing.php')">text</a>
This anchor works fine in Chrome, and even in IE, but when I use it in FF, the browsers redirects to "http://javascript: $('#dash-main').load('billing.php')".
Any idea what is wrong?
I have an anchor that triggers a javascript which uses jquery:
<a href="javascript: $('#dash-main').load('billing.php')">text</a>
This anchor works fine in Chrome, and even in IE, but when I use it in FF, the browsers redirects to "http://javascript: $('#dash-main').load('billing.php')".
Any idea what is wrong?
Share Improve this question asked Aug 4, 2012 at 15:44 Dan SternDan Stern 2,1678 gold badges26 silver badges39 bronze badges 4- Consider connecting this to a function instead that calls it. – Robin Castlin Commented Aug 4, 2012 at 15:46
- Remember to accept and answer to get that accept rate up. – iambriansreed Commented Aug 4, 2012 at 20:58
- Can you link to an example? This is quite odd and unexpected behavior. – Boris Zbarsky Commented Aug 5, 2012 at 5:41
-
Don't use
javascript:
HREFs. Use the cross-browseronclick
event. – user229044 ♦ Commented Aug 10, 2012 at 2:28
3 Answers
Reset to default 10Use onclick and avoid the problem:
<a href="#" onclick="$('#dash-main').load('billing.php');return false;">text</a>
Why not use:
<a href="#" onclick="$('#dash-main').load('billing.php')">text</a>
Cross-browser patible!
Did you try returning false?
<a href="javascript: $('#dash-main').load('billing.php'); return false;">text</a>
本文标签: href javascript jquery not working in FFStack Overflow
版权声明:本文标题:href= javascript: jquery not working in FF - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741295968a2370818.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论