+ 1

Is there an attribute which dont allows to press a button

For example I want to click on button after which we cant never touch it again & onclick it will no do a func which i mentioned

6th Mar 2020, 4:50 PM
Albert Margaryan
Albert Margaryan - avatar
8 Respostas
+ 3
Why not just remove the function after the first click through a call to "removeEventListener()": https://www.sololearn.com/learn/JavaScript/2758/ Another method would be to set the CSS "pointerEvents" attribute to "none", I think: https://www.w3schools.com/cssref/css3_pr_pointer-events.asp
6th Mar 2020, 4:59 PM
Shadow
Shadow - avatar
+ 5
<button type="button"disabled>Click Me!</button> disabled attribute of button will be also helpful. Thank you
6th Mar 2020, 5:07 PM
Sanchay Kumar
Sanchay Kumar - avatar
+ 1
$("#btnSubmit").attr("disabled", true); For adding $("#btnSubmit").attr("disabled", false); For removing Inform me when this runs
6th Mar 2020, 5:25 PM
Sanchay Kumar
Sanchay Kumar - avatar
0
Thanks a lot
6th Mar 2020, 5:05 PM
Albert Margaryan
Albert Margaryan - avatar
0
How can I add disabled attribute using jquery or js
6th Mar 2020, 5:20 PM
Albert Margaryan
Albert Margaryan - avatar
0
Using jquery u can use .attr() function for adding the attribute to the button.
6th Mar 2020, 5:22 PM
Sanchay Kumar
Sanchay Kumar - avatar
0
setup jquery in your html document otherwise code of #sanchay will not work
10th Mar 2020, 9:34 AM
Shadman Sakib
Shadman Sakib - avatar
- 1
But disabled tag isnt adding i tryed
6th Mar 2020, 5:22 PM
Albert Margaryan
Albert Margaryan - avatar