0

Hi all..

I am having controls such as dropdown,button,textbox in my aspx page .I need to enable and disable them using javascript..I am beginner in Javascript...Some one help with code in javascript as early as possible...

Thanks & regards,

Balaguru

2
Contributors
1
Reply
4
Views
10 Years
Discussion Span
Last Post by ~s.o.s~
0

See this sample snippet:

<html>
<head>
</head>
<body>
    <form name="frm">
        <input type="text" name="txt" value="Hello" />
        <input type="button" onclick="this.form.txt.readOnly = true;" value="Disable text field" /> 
        <input type="button" onclick="this.form.txt.readOnly = false;" value="Enable text field" />
        <br /><br />
        
        <input type="button" value="My Button" name="btn" /> 
        <input type="button" onclick="this.form.btn.disabled = true;" value="Disable button" /> 
        <input type="button" onclick="this.form.btn.disabled = false;" value="Enable button" />
        <br /><br />
        
        <select name="mySelect">
            <option value="india">India</option>
            <option value="america">America</option>
        </select>
        <input type="button" onclick="this.form.mySelect.disabled = true;" value="Disable drop down" /> 
        <input type="button" onclick="this.form.mySelect.disabled = false;" value="Enable drop down" />
    </form>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.