I want to use OR for selectors in jquery.
I write this code:
$("#x").css('display') == 'none' || $("#y").css('display') == 'none'
But refer this answer: https://stackoverflow.com/a/2263976/1407491
I rewrite that code be like this:
$("#x, #y").css('display') == 'none'
This code work fine about this sample code:
<div id="x"></div>
<div id="y"></div>
return false and it's OK.
<div id="x" style="display:none"></div>
<div id="y" style="display:none"></div>
return true and it's OK.
<div id="x" style="display:none"></div>
<div id="y"></div>
return true and it's OK.
But don't work about this sample:
<div id="x"></div>
<div id="y" style="display:none"></div>
return false but it is NOT OK!
Sample code here: http://jsfiddle.net/NabiKAZ/qpquuhxd/
Why is it? and What's clean code?