Here is my code :
<div id="reason_bars">Reason <select style="width:200px;" disabled="disabled"><option><option></select>
<div class="edit" style="position:absolute;left:212px;top:50px;">Edit</div></div>
i want to trigger an event, where , if one clicks on the div with class=”edit” , the element(its sibling) gets enabled,
i tried the following code :
$(document).ready(function () {
$("#reason_bars .edit").click(function () {
var parent=$(this).parent();
$(parent+" select").removeAttr("disabled");
});
});
this doesn’t work.
Is there any alternative ?
Thanks!
Try
In your line
$(parent+" select")parent is a reference to an object, not a string which is why it doesnt work. You also can use the jQuery sibling selector to simplify things.Hope this helps!