单击后如何禁用html按钮而不是提交按钮
我有一个html按钮,当您按它时,它应该为您提供距离您所在的商店的距离,因此,当您按它时,它们现在出现了问题,因为这是在早期阶段,每次打印该信息时按下按钮时,我现在想如何在按下一次按钮时将其禁用,然后在按下另一个按钮时将其重新激活,这不是提交按钮,所以我对该按钮的代码是:
hi i have a html button and when you press it, it should give you the distances of shops from where you are so when you press it they appear now the problem is because it is in early stages the information is printed everytime the button is pressed i would just like to now how to disable it when it has been pressed once and then reactivate it when another button has been pressed this is not a submit button my code for the button is :
<button onclick="getLocation()">Search</button>
任何帮助将不胜感激
我认为这对您来说很清楚.
I think its very clear for you..
在click事件中调用getlocation()方法.
Call your getlocation() method inside the click event..
代码
$( "#bind" ).click(function() {
$(this).attr("disabled", "disabled");
$("#unbind").removeAttr("disabled");
});
$( "#unbind" ).click(function() {
$(this).attr("disabled", "disabled");
$("#bind").removeAttr("disabled");
});
输出