views:

60

answers:

3

I am successful in selecting the first <li> of the <ul>

i want to select the remaining of the <li> except the current selected <li> . i.e., (inverse)

How can I select it. Please help

EDIT 1 As per request

var newEle = $(str); //str contains a <li> i.e., <li>Some content</li>
$(newEle).hide();
A: 

Assuming the result of your selection in an Array you can use the jQuery methods pop() or splice(begin,end) to select the elements you want. Both are documented here (right before "Boolean default" headline).

halfdan
A: 

Do you need something like this:

<ul id='myUL'>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ul>

jquery

$('ul#myUL > li').each(function(index) {
     if( index !=  '0'){
          alert(index + ': ' + $(this).text());
     }
});

Check

NAVEED
A: 

http://api.jquery.com/not-selector/ Solves my problem

Rajasekar