jQuery - to check HTML attribute exist or not

0 votes
139 views
added May 22, 2020 in jQuery by lcjr First Warrant Officer (9,190 points)
$.fn.hasAttr = function(name) {  
    return this.attr(name) !== undefined;
  };

  if(!$(dfpStoFullId).hasAttr('data-google-query-id')){ 
    HideSto();  
    $(stoEl).hide();
    console.log('sto display none');
  }

 

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