Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-17-2009, 06:44 PM   PM User | #1
becked
New to the CF scene

 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
becked is an unknown quantity at this point
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 );
});
becked is offline   Reply With Quote
Old 09-17-2009, 07:04 PM   PM User | #2
becked
New to the CF scene

 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
becked is an unknown quantity at this point
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.
becked is offline   Reply With Quote
Reply

Bookmarks

Tags
internetexplorer, javascript, prototype

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:40 PM.


Advertisement
Log in to turn off these ads.