Set button to disabled state in the beginning If the input value of the required field is empty, let the button remain disabled. It is used to submit the content. Output: Clicking on the Get Free button: Clicking on the Get Premium button: Clicking on the Reset options button: Method 2: Using attr method: It is similar to the above method and more suitable for older jQuery versions. $("#rbu What is the best way to invert this behaviour? generated HTML: Output: You can also block the browsers back button by using Vanilla JavaScript for that you can follow this How to stop the browser back button using JavaScript article. jQuery UI includes two ways to disable the button () widget: the disabled option allows you to initialize the button in a disabled state, while the disable () method allows you to disable in If the immediately following The .prop () method should be used to set disabled and checked instead of the .attr () method. Once youve clicked on the button, you will find that you wont be able to click on it again until you have refreshed the page. When using a button to validate several editors on a page, the button must "know" in which validation group these editors are located. Updated for Bootstrap 3.3.4: This will allow you to have different display text and data value for each element. Try this function disable(i){ jQuery Web Development Front End Technology. To remove disabled attribute using jQuery, use the removeAttr () method. You need to first remove the property using the prop () method. It will set the underlying Boolean value to false. $("#rbutton_"+i).attr("disabled",true); Projects In JavaScript & JQuery. (Disabled state = TRUE) If the input value of the To disable the button in a jQuery dialog from a function carried using jQuery based on the following approaches. You can easily use the method prop () of jQuery to enable or disable form elements like ,