Reputation: 3
Trying different ways to change the state of a button by removing the class "disabled". After having tried various suggestions that I found online I have still not been able to get it working as I would like it. Below is the snippet of from the view
<tr>
<td>
<input type="checkbox" name="chk" id="chk" onclick="enableSubmit()">I accept the
<a target="_blank" href="<c:url value='/TermsAndConditions' />" rel="nofollow" >terms and conditions
</a> of this transaction
</td>
</tr>
<tr>
<td style="align: left;">
<a class="btn btn-default" href="<c:url value='/Cancel' />/${order.id}" role="button">
<spring:message code="result.back" />
</a>
</td>
<td style="text-align: right;">
<a id="submitBtn" class="btn btn-primary disabled" href="<c:url value='/Confirm' />/${order.id}" role="button" >
<spring:message code="result.submit" />
</a>
</td>
</tr>
below is lastest attempt I have tried
<script>
function enableSubmit(){
$('#submitBtn').removeClass('disabled');
}
</script>
any guidance on what I am doing wrong will be greatly appretiated
Upvotes: 0
Views: 227
Reputation: 403
You are trying to modify a class not id of SubmitBtn.
Change $('.submitBtn')
to $('#submitBtn')
Upvotes: 0
Reputation: 228
Your script contains a typo.
the . selects an element with a class, the # will select an ID. since you used
function enableSubmit(){
$('#submitBtn').removeClass('disabled');
}
this should fix it.
Upvotes: 0
Reputation: 691913
$('.submitBtn')
allows selecting the elements having the CSS class submitBtn
. What you want is select the element which has the id submitBtn
:
$('#submitBtn')
Upvotes: 2
Reputation: 4636
Try:
</script>
function enableSubmit(){
$('#submitBtn').removeClass('disabled');
}
</script>
.submitBtn
is for a class #submitBtn
is for an id
Upvotes: 1