Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2009
    Location
    Chicago, IL
    Posts
    169
    Thanks
    26
    Thanked 3 Times in 3 Posts

    JS not working properly in IE

    I have a radio group that, when a certain option is selected, it makes the radio group disappear and a textbox appear. It works great in Firefox, but it appears to be glitchy in IE. Any ideas?

    Code:
    <script type="text/javascript">
    function showRestaurantTextBox()
    {
      document.getElementById("restauranttxt").style.display = "Block";
      document.getElementById("specifyRestaurant").style.display = "None";
    }
    </script>
    <div id="specifyRestaurant">    
      <label>
        <input name="radio" type="radio" id="checkAll" value="checkAll" checked="checked" />
        All Restaurants
      </label>
      <label>
        <input type="radio" name="radio" id="checkSpecify" value="checkSpecify" onchange="javascript:showRestaurantTextBox()" />
        Specify...
      </label>
    </div>
    <input type="text" name="restaddrestaurant" id="restauranttxt" style="border:#868687 1px solid;display:none" value="<?php echo $input1; ?>" autocomplete=off />
    <div id="restsuggest" style="visibility:hidden;border-left:#000000 1px solid;border-bottom:#000000 1px solid;border-right:#000000 1px solid;width:149px;"></div>
    Last edited by wldrumstcs; 07-29-2009 at 02:28 AM.

  • #2
    Banned
    Join Date
    Nov 2008
    Location
    not found
    Posts
    284
    Thanks
    0
    Thanked 53 Times in 51 Posts
    Don't use onchange since it doesn't fire in I.E. until the element loses focus; use onclick. Also you can replace javascript: with nothing.

  • Users who have thanked randomuser773 for this post:

    wldrumstcs (07-29-2009)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •