radarhill
asked on
jQuery Each - Value of Label for=""
I'm trying to retrieve the value of the for="" using jQuery's each. I'm looking for the EventStartMonth and EventEndMonth values. Am I on the right track or is there a better approach? Thanks.
<script>
$(function(){
$.each( $( '.input.datetime label[for$=Month]' ) , function( k , v ){
alert( v.value );
});
});
</script>
<div class="input datetime">
<label for="EventStartMonth">Start</label>
<select name="data[Event][start][month]" id="EventStartMonth">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
</select>
<label for="EventEndMonth">End</label>
<select name="data[Event][end][month]" id="EventEndMonth">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
</select>
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Exactly what I was after.
Open in new window