Solutionabc
asked on
jquery: How do I add a class to the td holding my input field?
Hi,
I am trying to add a class to the <td> that is holding my span and input field but I can only seem to add the class to the span tag that is holding the input field.
the form is like this:
<td><span><Input/></span>< /td>
I am using Jquery, please modify the code below.
Thanks.
I am trying to add a class to the <td> that is holding my span and input field but I can only seem to add the class to the span tag that is holding the input field.
the form is like this:
<td><span><Input/></span><
I am using Jquery, please modify the code below.
Thanks.
$(document).ready(function(){
$(".orderQty span INPUT").change(function(){
if($(this).val() > 0 ) {
$(this).parent().addClass("selected");
} else {
$(this).parent().removeClass("selected");
}
});
-----------------------------------------------------------
<td class="orderQty"><span dir="none">
<input name="ctl00$m$g_7279058e_e51a_4bdc_bae0_cf09ae6c9811$ff10_1$ctl00$ctl00$TextField" type="text" value="0" id="ctl00_m_g_7279058e_e51a_4bdc_bae0_cf09ae6c9811_ff10_1_ctl00_ctl00_TextField" title="OrderQty" class="ms-input" Size="11" style="ime-mode:inactive;" /><br></span></td>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.