简体   繁体   中英

jquery hide show table td

I want to hide all the (TD) if one my class does meet input field pls suggest

<tr>
    <th>Rm</th>
        <td class="CorriderTmp">CorriderTmp </td>

        <td class="Tem">TemBalcony3 </td>

        <td class="Balp New ">BalconyTmp New  </td>

        <td class="BalconyTmp New ">BalconyTmp New  </td>

        <td class="hmmm test">hmmm test </td>

        <td class="Template Via Name">Template Via Name </td>

        <td class="Bar Test Template">Bar Test Template </td>

        <td class="na">na </td>

        <td class="nas">na </td>



</tr>

$("#searchtemplate").click(function(){
    var getfilterrecord = $("#filterrecord").val(); // get the data after type
    if(getfilterrecord == "CorriderTmp"){
        $(".CorriderTmp").show();
    }
});

I would like to hide up all the data except which meet class after inputing the value how it possible using jquery

$("#searchtemplate").click(function() {
    var getfilterrecord = $("#filterrecord").val(); 
    $("table td").hide();
    $("."+getfilterrecord).show();
});

Something like below,hiding all and showing them again. Although your HTML doesn't really make much sense.....

$("#searchtemplate").click(function(){    
     $("table td").hide();
     $("." + $("#filterrecord").val()).show();        
});

See this Fiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM