嗨,我有以下代码:
collapsed.on('click', 'a',function(c) {
c.preventDefault();
});折叠基本上是一个div元素,在这个div中有一个锚标签,因为它的防止功能,它不能工作。预防功能需要存在。有没有一种方法可以让锚标记在div中工作,即使是使用preventDefault函数?
如果你需要更多信息,请告诉我。
发布于 2012-08-01 00:32:58
这将把用户送上他们的快乐之路。
collapsed.on('click', 'a',function(c) {
c.preventDefault();
window.location = this.href
/*
other options include:
window.location = $( this ).attr( 'href' );
window.location = this.getAttribute( 'href' );
window.location = 'http://staticurl.com';
*/
});我怀疑你的标记有设计上的缺陷...如果你把它贴出来,也许你可以避免在你的链接上使用preventDefault。
发布于 2012-08-01 20:22:18
问题解决了。我没有在折叠的div上应用click事件,而是在一般的折叠div上应用了click事件。
谢谢你们
https://stackoverflow.com/questions/11744777
复制相似问题