Strider27 Strider27 - 7 months ago 39
CSS Question

Jquery Add .css to label based on wildcard ID

I have the following generated code that needs to be modified with jquery

<input id="priority1" type="radio" name="priority" value="Low" disabled="">
<label for="priority1">Low</label>
<input id="priority2" type="radio" name="priority" value="Normal" disabled="">
<label for="priority2">Normal</label><input id="priority3" type="radio" name="priority" value="High" disabled="">
<label for="priority3">High</label>
<input id="priority4" type="radio" name="priority" value="CRITICAL" disabled="">
<label for="priority4">CRITICAL</label>

I need to add padding to each label (
padding-right: 30px;

I have tested with this:

$j("label[for='priority1']").css("padding-right", "30px");

It works and it could be argued that I can just repeat it four times for each label; however, I want to use a wildcard like so
$j("label[for='[id^=priority]']").css("padding-right", "30px");
. Unfortunately that did not work, any help would be appreciated.

$("label[for^='priority']").css("padding-right", "30px");

Seems to work fine here, no need to add id stuff.