html - Javascript: Check if classname exists -


<div class="trade">     <div id="offer">         <div class="noresults">no result!</div>         <div class="footerpager"> <span id="offer"><a disabled="disabled">first</a>&nbsp;<a disabled="disabled">previous</a>&nbsp;<a disabled="disabled">next</a>&nbsp;<a disabled="disabled">last</a>&nbsp;</span>         </div>     </div> </div> 

here javascript:

function check(){ return !(iframe.contentdocument.getelementbyid("offer").firstelementchild.tagname.tolowercase() == "table"); } 

is possible return true or false value check if class "noresult" exists? if so, how do it? guys rocks. can't change html coding, javascript.

use classlist.

var hasclass = element.classlist.contains('some-class'); 

further reading (disclaimer: link own post).

if not supported in target platforms, try...

var hasclass = (" " + element.classname + " ").indexof(" some-class ") > -1; 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -