Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery可单击表行在IE中不起作用_Jquery_Internet Explorer - Fatal编程技术网

Jquery可单击表行在IE中不起作用

Jquery可单击表行在IE中不起作用,jquery,internet-explorer,Jquery,Internet Explorer,我正在尝试在rails视图中创建可单击的表行,现在我正努力让它在IE上工作 我看到了这个问题的另一个答案,但我不知道它与我的情况有什么关系,所以就这样 这是我的jquery jQuery( function($) { $('tbody tr[data-href]').addClass('clickable').click( function() { window.location = $(this).attr('data-href'); }).find('a').h

我正在尝试在rails视图中创建可单击的表行,现在我正努力让它在IE上工作

我看到了这个问题的另一个答案,但我不知道它与我的情况有什么关系,所以就这样

这是我的jquery

jQuery( function($) { 
    $('tbody tr[data-href]').addClass('clickable').click( function() { 
    window.location = $(this).attr('data-href'); 
    }).find('a').hover( function() { 
        $(this).parents('tr').unbind('click'); 
    }, function() { 
        $(this).parents('tr').click( function() { 
            window.location = $(this).attr('data-href'); 
        }); 
    }); 
}); 
下面是一些标记(所有标记都已关闭):

*编辑-*

除非重新启动IE,否则如果打开开发人员控制台,然后关闭它,它可以正常工作。
这真的让我很困惑。

你是否关闭了
tr
标签(即
)?是的,他们已经关闭了,我将用完整的视图更新问题。请将$(This.attr('data-href')分配给window.location.href。window.location.href=$(this.attr('data-href');我更新了一个显示更新代码的编辑,仍然在chrome和firefox中工作,但没有IE:(它可能有助于显示实际呈现的标记,其中没有注释标记和ruby标记。例如,在为悬停事件显示的内容中没有“a”标记。
<table id="gradient-style">
    <thead>
      <tr>
        <th scope="col">First name</th>
        <th scope="col">Last name</th>
        <th scope="col">Home phone</th>
        <th scope="col">Work phone</th>

        <th scope="col">Division</th>
        <th scope="col">Email</th>
       </tr>
    </thead>
    <tfoot>
        <tr>
            <td colspan="6">Give background color to the table cells to achieve seamless transition</td>

        </tr>
    </tfoot>
    <tbody>
  <tr data-href="/players/657/edit" class="odd">
    <td>joe</td>
    <td>bloggs</td>
    <td>0123456789</td>

    <td></td>
    <td></td>
    <td>email@email.com</td>
  </tr>
  <tr data-href="/players/676/edit" class="even">
    <td>joe</td>
    <td>bloggs2</td>
    <td>123456789</td>
    <td>123456789</td>
    <td></td>
    <td>lala@live.com</td>
  </tr>
jQuery( function($) { 
    $('tbody tr[data-href]').addClass('clickable').click( function() { 

         window.location.href = $(this).attr('data-href');
    }).find('a').hover( function() { 
        $(this).parents('tr').unbind('click'); 
    }, function() { 
        $(this).parents('tr').click( function() { 
            window.location.href = $(this).attr('data-href'); 
        }); 
    });