1

This is a sample html

<iframe id="theiframe">
...
<form>
    <div class="pluginConnectButton">
        <div class="pluginButton pluginButtonInline pluginConnectButtonDisconnected" title="">
            ...
        </div>
        <div class="pluginButton pluginButtonPressed pluginButtonInline pluginButtonX pluginConnectButtonConnected hidden_elem" title="">
            ...
        </div>
</form>
...
</iframe>

I want if the div with class pluginButton pluginButtonInline pluginConnectButtonDisconnected has class "hidden_elem" and is in the iframe with id = theiframe, then to do some action

shaxaaa
  • 151
  • 1
  • 8

2 Answers2

0

http://jsfiddle.net/vt8WW/

alert($('#theiframe').hasClass('hidden_elem'));

Use it like this

underscore
  • 6,495
  • 6
  • 39
  • 78
0

Try

var el = $('.pluginButton.pluginButtonInline.pluginConnectButtonDisconnected');
if(el.hasClass('hidden_elem') && el.closest('#theiframe').length){
    //do something
}
Arun P Johny
  • 384,651
  • 66
  • 527
  • 531