jQuery .find() method

0 votes
275 views
added Apr 2, 2018 in jQuery by LC Marshal Captain (25,790 points)

Find element in parent element

$('.sticky-prop-header').find('span.expiry_msg').fadeIn(400);

2 Responses

0 votes
responded Apr 2, 2018 by LC Marshal Captain (25,790 points)
selected Apr 2, 2018 by LC Marshal
 
Best response

Find element only inside this parent element

$('.listing-summary').each(function(){
      var summaryprice = $('.price.at-summary').text();
      if ( summaryprice.length < 30 ) {
        $(this).find('span.expiry_msg').addClass('x-m-expired').fadeIn(400);
      }
      else {
        $(this).find('span.expiry_msg').fadeIn(400);
      }
    });
0 votes
responded Apr 2, 2018 by LC Marshal Captain (25,790 points)

$( "li.item-ii" ).find( "li" ).css( "background-color", "red" );

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...