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
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Only in IE, prototype's Element.update() doesn't work multiple times

    The following code works find in firefox and chrome. In IE, it only works the first time I click on a link. Any ideas?

    Thanks in advance,

    // I have some div's where help is, which I make non-viewable
    <div id='help_guides'>
    <div id='issue1'>Help with issue 1</div>
    <div id='issue2'>Help with issue 2</div>
    </div>
    <a href="#" id="issue_1_link">Help with issue #1</a>
    <a href="#" id="issue_2_link">Help with issue #2</a>
    <div id='help'></div>

    // I grab the help guide div into a variable
    var issue_1_help = $('issue_1').remove();
    var issue_2_help = $('issue_2').remove();

    // When the help link is clicked, the help DIV displays the help guide
    Event.observe( $('issue_1_link'), 'click', function() {
    $('help').update( issue_1_help );
    });
    Event.observe( $('issue_2_link'), 'click', function() {
    $('help').update( issue_2_help );
    });

  • #2
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, I believe the reason is that I am creating multiple elements with the same ID, causing IE confusion. Changing:
    var issue_1_help = $('issue_1').remove();
    to:
    var issue_1_help = $('issue_1').remove().innerHTML;

    seems to have resolved the issue.


  •  

    Tags for this Thread

    Posting Permissions

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