Search code examples
jquerygetnextsibling

jQuery using nextSibling to pull out data


I am trying to only pull out the number "88" in the example below:

    <li>
       <a href="website">5 stars</a>
       (88)
    </li>

I have tried:

var theLi= $('li');
var theNumber = $(theLi.get(0).nextSibling).text();

but nothing comes up..it is blank.


Solution

  • how about

    var theNumber = $('li').after( $('a') ).text().replace('(','').replace(')','')

    This works.