Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select box styling issue

i have this select box :

<select class="slctbx condition-Combiner" onchange="updateConditionBuilder()" style="color: rgb(153, 153, 153);" disabled="disabled">

and i am using :

$('#rule-condition-listing tr:last-child .condition-Combiner').removeAttr("style","#999999").removeAttr("disabled","disabled");

so it actually removes disabled attribute but not the color attribute

like image 944
Garry Avatar asked Jun 06 '26 09:06

Garry


2 Answers

.css() - Get the value of a style property for the first element in the set of matched elements or set one or more CSS properties for every matched element.

$('#rule-condition-listing tr:last-child .condition-Combiner').
  css("color","#999999").
   removeAttr("disabled","disabled");

or

$('#rule-condition-listing tr:last-child .condition-Combiner').
  css("color","").
   removeAttr("disabled","disabled");
like image 74
Pranay Rana Avatar answered Jun 07 '26 22:06

Pranay Rana


As stated in the jquery Api documentations, the removeAttr - function only accepts 1 condition. so if you do something like

$('#rule-condition-listing tr:last-child .condition-Combiner').removeAttr("style","#999999").removeAttr("disabled","disabled");

it means that you remove the style on the element, and the '#999999' is discarded. Same goes for the disabled part.

I hope it helps.

Kind regards, Alex

like image 24
Ilinea Avatar answered Jun 08 '26 00:06

Ilinea