disabled input - Enable does not work jQuery -


i try disable/enable textbox depending on input other textbox has. when role textbox's input _teacher_, the subject textbox enable. otherwise, disabled.

problem not enable when input teacher

function check(event) {     if ($('#role').val().tolowercase() == "teacher")             $("#subject").removeattr("disabled");      else         $("#subject").attr("disabled", "disabled");  } 

view.tpl

<input type="text" class="input-block-level" id="role" onkeypress="check(event)" placeholder="teacher/hr" name="role"/> <br/> <input type="text" class="input-block-level" id="subject" placeholder="subject(only if teacher) " name="subject"/> <br/> 

try $("#subject").prop("disabled", false); enable , $("#subject").prop("disabled", true); disable element


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -