Why won’t this work? It should check the element for display css style.
if (byId("annonsera_price").style.display=='inline' || byId("annonsera_price").style.display=='block'){
alert ("Hello");
}
function byId(x){
return document.getElementById(x);
}
update2:
<input style="width:100px;" type="text" name="annonsera_price" id="annonsera_price">
I haven’t set it with css either!
First try alerting just the style.display and see what it contains:
styleonly references what is in the style attribute (or set through JS on the style property). It’s possible that the display is set through the class, and thereforeel.style.displaywon’t show anything.[Update]:Given the update, the reason no alert happens is because
style.displaywill be “”, not “inline” or “block”. It won’t be “inline” or “block” until you set it to something, either in thestyleattribute or by setting.style.display.