2012-09-25 19 views
1

我有IE的问题在浏览器的所有版本(谁不)。它适用于其他浏览器。IE(所有版本)以下的href,而不是执行JS

<a href="<?php echo base_url() ?>pages/delete_page/<?php echo $row->id; ?>" class="delete" data-uid="<?php echo $row->id; ?>"> 
    <i class="icon-cancel"></i><span class="delete_tooltip">delete page</span> 
</a> 

这是我的<a>标签,它非常简单。

基本上IE是继href和不执行JS的。如果我从href中删除链接,它会将其发送回主页。

我使用的插件加载一个模式对话框就像我说的,一切都在每一个浏览器工作正常。

$('.delete').click(function(e) {  
    console.log($('#modal-'+$(this).data('uid'))); // Button which will activate our modal 
    $('#modal-'+$(this).data('uid')).reveal({    // The item which will be opened with reveal 
     animation: 'fadeAndPop',    // fade, fadeAndPop, none 
     animationspeed: 400,   // how fast animtions are 
     closeonbackgroundclick: false, // if you click background will modal close? 
     dismissmodalclass: 'modal_cancel'  // the class of a button or element that will close an open modal 
    }); 
    return false; 
}); 

这就是调用该链接插件的JS。

任何帮助将不胜感激。

回答

1

,这可能是一个有趣的一个...

console.log($('#modal-'+$(this).data('uid')));会导致IE异常,以便假永远不会返回引起href执行其默认操作。

编辑: 可能在这里造成了一些混乱。在IE中它会引起异常,因为consoleundefined

+0

哦,非常好,谢谢。我不知道IE做到了。今天学到了一些东西。 –

+1

控制台未在IE中定义 –

+0

@chumkiu:如果您在加载页面之前已经开启了开发工具,则只能在IE中定义“控制台”。这是愚蠢的。 –

0
$('.delete').click(function(e) { 
    e.preventDefault(); 
    ... 

使用preventDefault()处理程序

http://api.jquery.com/event.preventDefault/内部参考

+1

谢谢,这可能会在未来派上用场,但我的代码中有一个console.log ...我不知道它使IE无法正常工作。 –

相关问题