Skip to content Skip to sidebar Skip to footer

Disable TextBox By Checked Radio Button?

i created some javascript to disable input textbox when a radio button is checked and it works fine in firefox but in IE it doesn't work? What Can i Do? the example function displa

Solution 1:

It's possible that IE doesn't run the code until the checkbox that was checked loses input focus. This is, I believe, how IE operates its onchange method. At the end of your display_input() function, try calling blur() on the checkbox:

function display_input(inputvalue)
{
  if(inputvalue == '1')
  {
    document.getElementById('time11').disabled = true;
    document.getElementById('time12').disabled = true;
    document.getElementById('date2').disabled = true;
  }
  else if(inputvalue == '2')
  {
      document.getElementById('time11').disabled = false;
      document.getElementById('time12').disabled = false;
      document.getElementById('date2').disabled = false;
  }
  // Blur focus on the checkbox...
  document.getElementById('theCheckBoxId').blur();
}

Post a Comment for "Disable TextBox By Checked Radio Button?"