javascript - adding values to specific elements using CSS -
i have many input elements created dynamically. want elements not disabled, , add border color them. css, can disabled doing this:
input[type="text"][disabled] { border-color: black; }
this works perfectly.
i have tried not disabled doing this:
input[type="text"][enabled] { border-color: green; }
this not work reason, , not getting error.
the reason why don't want use js/jquery, browser ends using more 100% of cpu on page load. guilty code looks this:
var elements = $(":input"); var elementsvisible = elements.prop("disabled"); if(!elementsvisible) { $(this).css("border-color", "green") : }
how enabled input fields css file? using extjs way. if possible , has more benefits using js/jquery css, listening :-)
input[type="text"] { background-color: green; } input[type="text"][disabled] { background-color: black; }
<input type="text" name="text_1" /> <br /> <input type="text" name="text_1" disabled/> <br /> <input type="text" name="text_1" /> <br /> <input type="text" name="text_1" disabled/> <br /> <input type="text" name="text_1" />
edit: though both [disabled]
, :disabled
work same way, i'd use :disabled
. kept close code possible.
Comments
Post a Comment