Monday, 15 June 2015

jquery - Change input field type to read only using JavaScript -



jquery - Change input field type to read only using JavaScript -

i making form. trying create input field read on base of operations of value entered.

<input type="radio" name="sex" value="male">male<br/> <input type="radio" name="sex" value="female">female <br/> age:<input type="text" name="age" id="age" size="20"> hobbies:<input type="text" name="hobbies" id="hobbies" size="20"><br/> phone:<input type="text" name="phone" id="phone" size="20"><br/>

if click on female text fields having id's "age" & "phone" becomes read , changes background color grey.

kindly guide me how create input input read only.

it seems looking disable input.

using jquery:

$(".inputname").attr("disabled", true);

javascript jquery

No comments:

Post a Comment