Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - check if element is exist (simplify version)

0 votes
34 views
added Nov 27, 2019 in jQuery by lcjr Sergeant (2,140 points)
var propPlacement = $('body.page-content .news-body.content p:nth-child(4)'), 
    newsTopProp = $('body.page-content .featured-properties');
if(propPlacement) {
  newsTopProp.appendTo(propPlacement);
}

 

1 Response

0 votes
responded Feb 14 by lcjr Sergeant (2,140 points)
if(yourElement.length){
    // do here
}

 

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