Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 2.68 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to remove the li element using jQuery after page load?
  2. <ul data-role="listview">
  3.                         <li>
  4.                             <a href="user_settings.html">
  5.                                 <img src="images/info/info-settings.png" width="30" height="30" class="ui-li-icon"/>
  6.                                 <h2>User Settings</h2>
  7.                             </a>
  8.                         </li>
  9.                         <li>
  10.                             **<a href="logout.html">
  11.                                 <img src="images/info/info-logout.png" width="30" height="30" class="ui-li-icon"/>
  12.                                 <h2>Logout</h2>
  13.                             </a>**
  14.                         </li>
  15.                         <li>
  16.                             <a href="http://someurl.com/store?app=ok" rel="external">
  17.                                 <img src="images/info/info-also-from.png" width="30" height="30" class="ui-li-icon"/>
  18.                                 <h2>Also from Us</h2>
  19.                             </a>
  20.                         </li>
  21.                         <li>
  22.                             <a href="about_us.html">
  23.                                 <img src="images/info/info-aboutUs.png" width="30" height="30" class="ui-li-icon"/>
  24.                                 <h2>About Us</h2>
  25.                             </a>
  26.                         </li>
  27.                         <li>
  28.                             <a href="about_us.html">
  29.                                 <img src="images/info/infsomeimage.png" width="30" height="30" class="ui-li-icon"/>
  30.                                 <h2>About Us</h2>
  31.                             </a>
  32.                         </li>
  33.                         <li>
  34.                             <a href="about_legal_info.html">
  35.                                 <img src="images/info/info-legalInfo.png" width="30" height="30" class="ui-li-icon"/>
  36.                                 <h2>Legal Info</h2>
  37.                             </a>
  38.                         </li>
  39.                         <li>
  40.                             <a href="about_international_dates.html">
  41.                                 <img src="images/info/info-international.png" width="30" height="30" class="ui-li-icon"/>
  42.                                 <h2>About International Dates</h2>
  43.                             </a>
  44.                         </li>
  45.                     </ul>
  46.        
  47. $("li").has("a[href='logout.html']").remove();
  48.        
  49. $("li:contains('Logout')").remove();
  50.        
  51. $('li a[href="logout.html"]').closest('li').remove();
  52.        
  53. $(document).ready(function() {
  54.  
  55.   $('li a[href="user_settings.html"]').parents('li').first().remove();
  56.  
  57. });
  58.        
  59. $(function (){
  60.     $('a[href="logout.html"]').parent().css('display', 'none');
  61. });