I have two buttons on my page:
<a class="button accessLink"
id="loginLink"
data-disabled="false"
data-href="/MyAccount/Access/Login"
title="Login">Login</a>
<a class="button accessLink"
id="registerLink"
data-disabled="false"
data-href="/MyAccount/Access/Register"
title="Register">Register</a>
How can I use jQuery to make it so that if one of the buttons is clicked and if data-disabled is set to false then it:
I also don't want the click to event to work.
$('a[data-disabled]').click(function(e) {
if (!$(this).data('disabled')) {
e.preventDefault();
$(this).attr('data-disabled', 'true');
dialog(this);
}
});
This should work:
$("a.accessLink").click(function(e){
e.preventDefault();
if($(this).data("disabled") == false) {
$("a.accessLink").data("disabled", true);
dialog(this);
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.