我想在<table> </table>中的内部类中选择类

时间:2014-06-24 07:55:47

标签: jquery

jQuery("table[class*='BALLOON']  tr[class*='LINE_']").mouseover(function(e){




});



<table class="RESULT_CONTENT BALLOON">
            <thead>
                <tr>
                    <th> No<th>
                    <th class="showTooltipH"> Name    <th>
                    <th class="showTooltipH"> Last name<th>
                    <th clasenter code heres="showTooltipH"> Province<th>
                    <th class="showTooltipH"> Address <th>
                </tr>
            </thead>
            <tbody>enter code here
                <tr class="LINE_EVENT">
                    <td> 1<td>
                    <td class="showTooltip"> John<td>
                    <td class="showTooltip"> Mawin<td>
                    <td class="showTooltip"> Puket<td>
                    <td class="showTooltip"> 123 xxx xxx <td>
                </tr>
            </tbody>
        </table>

但它不起作用。 请帮帮我

4 个答案:

答案 0 :(得分:1)

让它更容易:$('table.BALLOON').find("tr[class^='LINE_']")

答案 1 :(得分:1)

这是你想要的:

JsFiddle: http://jsfiddle.net/7yfcn/

<强> JavaScript的:

$(function() {

    $('table.BALLOON').find("tr[class*='LINE_']").mouseover(function(e){
        //put your code here...
    });
});

HTML:无变化

答案 2 :(得分:0)

你的javascript应该可以正常运行。请务必关闭<th><td>代码,请参阅此处:http://jsfiddle.net/Ae9jq/

<table class="RESULT_CONTENT BALLOON">
<thead>
    <tr>
        <th> No</th>
        <th class="showTooltipH"> Name    </th>
        <th class="showTooltipH"> Last name</th>
        <th class="showTooltipH"> Province</th>
        <th class="showTooltipH"> Address </th>
    </tr>
</thead>
<tbody>
    <tr class="LINE_EVENT">
        <td> 1</td>
        <td class="showTooltip"> John</td>
        <td class="showTooltip"> Mawin</td>
        <td class="showTooltip"> Puket</td>
        <td class="showTooltip"> 123 xxx xxx </td>
    </tr>
</tbody>
</table>

答案 3 :(得分:0)

您的JS代码在表完全加载之前运行。只需用这个替换代码,你就可以了:

$(function() {jQuery("table[class*='BALLOON']  tr[class*='LINE_']").mouseover(function(e){
})});