• No categories

enable disable in jquery

Hello Everybody, here i am going to show, how you can enable or disable a combobox with jquery. you can download latest version of jquery from here [download jquery]. In this code i used two functions of jquery for adding and removing a attribute(disabled).
Jquery function attr(‘name’,’value’) is used to add an attribute to an html element. Function removeAttr(‘name’) is used to remove a attribute of html element by using jquery.
Insert a combobox using following code :
<select id=”mycombo” style=”width:200px;”>

Insert two buttons containg jquery code in click event, using following code :
<input type=”button” value=”Disable” onclick=”$(‘#mycombo’).attr(‘disabled’,’disabled’)”/>
<input type=”button” value=”Enable” onclick=”$(‘#mycombo’).removeAttr(‘disabled’)”/>

About the Author:

Comments are closed.