jQuery - check if element exist with .length

0 votes
184 views
added Jul 10, 2019 in jQuery by LC Marshal Captain (25,790 points)
if(contentPara.length) {
  contentPara.css({'margin-bottom': '600px'});
  parallaxFlg.css({'position': 'fixed', 'top': '140px', 'left': '0'});
}
else {
  alert('yo');
}

 

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