javascript - How to move table to the top of the DIV container based on a Condition with JQuery? -


i have multiple tables stacked inside div container below:-

<div id="mycontent"  style="display: block;">       <table id="mytable" cellspacing="0" cellpadding="0" >         <tbody>           <tr>             <td style="padding-top: 10px;">               <table>                 <tbody>                   <tr>                     <td align="left">                       health care                     </td>                   </tr>                   <tr>                     <td align="left">                       20 wisconsin ave</td>                   </tr>                   <tr>                     <td align="left">                       641.235.5900                     </td>                   </tr>                   <tr>                     <td align="left">                       no website                     </td>                   </tr>                 </tbody>               </table>             </td>             <td align="right">               <img src="images/phone.png" class="imgheader" >             </td>           </tr>         </tbody>       </table>       <table id="mytable" cellspacing="0" cellpadding="0">         <tbody>           <tr>             <td style="padding-top: 10px;">               <table >                 <tbody>                   <tr>                     <td align="left">housing</td>                   </tr>                   <tr>                     <td align="left">                       n/a</td>                   </tr>                   <tr>                     <td align="left">                       641.255.3884                     </td>                   </tr>                   <tr>                     <td align="left">                       www.housingl.org                     </td>                   </tr>                 </tbody>               </table>             </td>             <td align="right">               <img src="images/phone.png" class="imgheader" >             </td>           </tr>         </tbody>       </table>       <table id="mytable" cellspacing="0" cellpadding="0" >         <tbody>           <tr>             <td style="padding-top: 10px;">               <table>                 <tbody>                   <tr>                     <td align="left">                       employment</td>                   </tr>                   <tr>                     <td align="left">n/a</td>                   </tr>                   <tr>                     <td align="left">                       641.743.0500                     </td>                   </tr>                   <tr>                     <td align="left">                       http://www.noexperience.org                     </td>                   </tr>                 </tbody>               </table>             </td>             <td align="right">               <img src="images/phone.png" class="imgheader" >             </td>           </tr>         </tbody>       </table>     </div> 

i trying run condition find td n/a , move tables top. additional question bult on top of previous question:

finding text "n/a" , hiding image in table's next td

i have starting trouble code. support appreciated.

$('td:contains(n/a)').closest('table').prependto('#mycontent'); 

jsfiddle example


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -