Show
How to enable disable textbox when radio button selected using javascript and JqueryIn this tutorial, we will explain How to enable disable textbox when radio button selected using javascript and jquery with a live example. While designing the HTML form some times we require an option to enable disable textbox field when the user clicks or select the radio button. Here in this example, We will create a simple HTML form with 3 radio buttons and one textbox field and using jQuery the click() function to enable disable the textbox field.
Example-1. Enable Disable Textbox based on Radio Button selection using JqueryHTML CodeThe below HTML codes to create a simple form with radio buttons and Textbox.
Jquery CodeIn the below code the Jquery click function will enable disable the textbox field on radio button selection. Download Jquery Library
Example-2. Enable Disable Textbox based on Radio Button selection using JavascriptHTML CodeThe following HTML codes used to creating the simple HTML form.
Javascript CodeThe following javascript code is used to enable, disable the textbox based on the radio button is selected (checked) or unselected (unchecked)
ConclusionWe explained How to enable disable textbox when radio button selected or checked using jQuery and Javascript. Hope you like it so please like and share. See AlsoDownload Javascript form validationHow to show and hide div elements based on dropdown selectionHow do I GREY out a TextBox in JavaScript?Javascript: tools. eraser = function () { var tool = this; this. started = false; var varPenColor = "White"; context.
How do I disable input on click?prop('disabled', true); Will do. But keep in mind after you disable it (by the above code) onclick handler wont work as its disabled. To enable it again add $("#FullName").
What is TextBox in JavaScript?JavaScript TextBox - Modern Text Field with Floating Label. An extended version of the HTML input element that supports both pure-CSS and pure-JavaScript versions. Easily create input groups with icons, buttons, help text, and validation messages.
How do I disable a TextBox?We can easily disable input box(textbox,textarea) using disable attribute to “disabled”. $('elementname'). attr('disabled','disabled'); To enable disabled element we need to remove “disabled” attribute from this element.
|