jQuery - to check HTML attribute exist or not

0 votes
267 views
added May 22, 2020 in jQuery by lcjr First Warrant Officer (11,990 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.
...