Reputation: 5007
I have several forms with select/input buttons on one page. I want to click on a select form, get the id of it, and toggle disable on a button with the same name except its a class not an id.
my code so far:
$("#main").on("click",".list", function () {
var j = $(this).attr("id");
if(j) {alert(j);}
$("."+j).attr('disabled','disabled');
});
I cannot seem to reference anything with "."+j
any ideas?
<h2>Towns / Suburbs</h2>
<form method="POST" action="">
<select class="list" name="data_change" id="towns" size=10>
<option>foo</option><option>bar</option>
</select>
<div class="buttonGroup">
<input type="submit" class="button" name="Delete" value="Delete">
<input type="submit" class="button" name="Add" value="Add">
<input type="submit" class="button" name="Edit" value="Edit" class="towns">
</div>
</form>
Upvotes: 1
Views: 870
Reputation: 28995
You cannot have two class attribues, If you have more than one class, separate them with space.
<input type="submit" class="button towns" name="Edit" value="Edit" />
Upvotes: 3