All, I was stuck with below problem, Please help to review it .
I have two input text in the page . Let's say A and B.
When loaded the page , A is enabled to input text while B is disabled, After A onblur is fired , I will validate the value of A, if it is valid(equal to string value test
), then B is enabled to input text.
The problem is the A's on-blur event would be fired when I click anywhere of the page except clicking on the B, Because in that time ,B is disable. The code just looks like below.
<html>
<head>
<script type="text/javascript" >
function ATextOnBlur(obj)
{
if (obj.value=='test')
{
document.getElementById("BTxt").disabled=false;
}
}
</script>
</head>
<body>
<input type="text" id="ATxt" value="" onblur="ATextOnBlur(this);">
<input type="text" id="BTxt" value="" disabled="disabled">
</body>
<html>
And I did some test for it ,found even the click event can't be fired for the disabled element.
<html>
<head>
<script type="text/javascript" >
function textClick()
{
alert('click');
}
</script>
</head>
<body>
<input type="text" value="" disabled="disabled" onclick="textClick();">
</body>
<html>
I want to know if there is any solution for it in Jquery ? or it just can't be fixed no matter with JS or Jquery. Thanks.