I have two input text forms. When I select first input form the second one should become disabled, and vice-versa. Here is html:
I have a piece of code that works fine in Chrome, but doesn't work in Firefox
<div id='input-container' style="width:155px; height: 30px;">
<input onclick="somefunction()" class="input" style="width: 155px;" id='myText' />
</div>
<br />
<div id='input-container1' style="width:155px; height: 30px;">
<input onclick="somefunction1()" class="input1" style="width: 155px;" id='myText1' />
</div>
and here is Jquery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
// disable all the input boxes
$(".input").attr("disabled", true);
$(".input1").attr("disabled", true);
// add handler to re-enable input boxes on click
$("div:has(.input)").click(function() {
$("#myText").removeAttr("disabled");
$("#myText1").val(" ");
$("#myText1").attr("disabled",true);
});
$("div:has(.input1)").click(function() {
$("#myText1").removeAttr("disabled");
$("#myText").val(" ");
$("#myText").attr("disabled",true);
});
});
</script>
Does anybody know how to solve this?