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 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    86
    Thanks
    2
    Thanked 1 Time in 1 Post

    Show div on radio select

    Hi Guys,

    I have this code which shows or hides a div when an option button is selected.

    It works fine in FF and IE9, but not in IE8 or IE7. How can I make it work for IE7/IE8 ??

    Code:
    $("input:radio[name='del_col']").live('click', function(){
        if ($(this).val() == 'collect') {
    	$("#payment-method .checkout-content #delivery_address").hide();
        }
    	if ($(this).val() == 'deliver') {
    	$("#payment-method .checkout-content #delivery_address").show();
        }
      });

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    Why do you specifiy #delivery_address only as a sub-selector for .checkout-content? How many elements with id='delivery_address' do you have?

    Try this
    Code:
    $('#delivery_address').hide();
    // OR
    $('#delivery_address').show();
    This works in my IE8 (see example here)

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    86
    Thanks
    2
    Thanked 1 Time in 1 Post
    Hi Devnull,

    Your code works in IE8. Even if I use your code in my page I have to click the radio button twice to get the div to show and hide.

    Im guessing there is something else on my page which is stopping it from reacting instantly. But I cant figure it out.

    If I sent you a link would you be so kind, as to have a look for me ?

  • #4
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    go ahead

  • #5
    New Coder
    Join Date
    Aug 2002
    Posts
    86
    Thanks
    2
    Thanked 1 Time in 1 Post
    Hi devnull

    I have changed the code now to:

    Code:
    $("input:radio[name='del_col']").live('focus', function(){
    Seems to be better as its working in all browsers now inc IE7 & 8



  •  

    Posting Permissions

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