Start New Discussion within our Web Development Community

HI i have many forms in my application..
when some one see any form so i want to show form as "Only readable form" means i want to use disable form..
when someone click edit button so my form should enable for editing..
how to do it? can anyone help me?

On a form, you will have many HTML input elements. These elements can have an attributed called 'disabled'. If you enable/disable this attribute via JavaScript or easier with the jQuery library, you can control that behavior.

For example, the following code produces a disabled input button of type 'submit'.

<input type="button" value="Submit" disabled/>

Using jQuery, you can remove this attribute as follows: $("input").removeAttr("disabled")

<input  type="text" name="name" id="name"  onkeyup="document.getElementById('box_submit').disabled = this.value=='' ? true : false;"/>
    <input id="box_submit" type="button" value="Continue" name="check" disabled=""/>

try this button is enable only when some-one input somthing in text box

Try this

<script src=""></script>

<form id="formElem">
<label for="txtName">Name</label>
<input type="text" name="txtName" />
<label for="txtAddress">Address</label>
<textarea name="txtAddress"></textarea>
<a href="#NOD" class="disableForm" >Disable Form</a>
<a href="#NOD" class="enableForm" >Enable Form</a>

<script type="text/javascript">
        $('input, textarea').attr('disabled', true);
        $('input, textarea').attr('disabled', false);


if youre using jquery

function set_status(){
    $('formname input').each(function() {

or native javascript

function set_status(){
        var len = document.former.elements.length;  //please be noted that former is the name of your form
        for(var x=0;x<len;x++){
This article has been dead for over six months. Start a new discussion instead.