Reputation: 65940
<% using (Html.BeginAbsoluteRouteForm("PetDetail", new { controller = "Customers", action = "SavePetSitterRestrictionsAndPermissions", ownerKey = Model.Owner.Key, petKey = Model.Key }))
{ %>
<button type="submit" class="actionButton default">
Save</button>
<% }
} %>
I am having above like code for submit a form
.I need to disable a save button
after click the save button.
By using jquery how to do that?
I tried something looks like below:
var clickedBttn=$('.actionButton.default[type=submit][clicked=true]').val()
if (clickedBttn)
{
//btton disable code here
}
But never fires
above code.
Upvotes: 0
Views: 183
Reputation: 857
Try this...
$('.actionButton').click(function(){
$('p').text("Form submiting.....");
$('input:submit').attr("disabled", true);
});
Upvotes: 0
Reputation: 655
Simply obtaining a reference to the text property of the clicked button will not do what you want unfortunately. Some additional research will help here. I advise reading up on the click() jQuery method - http://api.jquery.com/click/
$('.actionButton.default[type=submit][clicked=true]').click(function() {
// button disable code here
$(this).attr("disabled", true);
});
Upvotes: 0
Reputation: 12815
You should simply register click event for that button:
$('.actionButton.default[type=submit]').click(function(){
$(this).prop("disabled", true);
})
Also, I know nothing like [clicked] attribute, so if do not set it somewhere, jquery will find nothing here $('.actionButton.default[type=submit][clicked=true]')
Upvotes: 1