So I have acquired the element I want, but I want to check the elements parent class value to verify it is a certain value before doing my logic and I can't quite figure it out.
$(document).ready(function() {
$('#childElement input').click(function() {
var option = $(this).parent('span').class;
alert(option.class);
if (option == 'left') {
//some action
}
});
The HTML is:
<span class="left">
<input type="checkbox" tabindex="401"><label>some verbage</label></span>
I am able to fire on the checking off of the checkbox, but I want to acquire the 'class' value of the span element (which i believe is the input element's parent. Then do an if comparison to check if class == "left".
Any thoughts what I am doing wrong?