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

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-28-2009, 07:06 PM   PM User | #1
sethwb
Regular Coder

 
Join Date: Aug 2008
Posts: 105
Thanks: 9
Thanked 0 Times in 0 Posts
sethwb is an unknown quantity at this point
Smile help!

The following code is driving me MAD...

I just want the h5 to be clickable, and when you click it it will show the company details, when you click it again it hides them! I'm seriously going crazy because the function works in firebug but not when I upload it to the site!!!!! ARRGH!!! Why would it do this???

Code:
jQuery(document).ready(function (){
	jQuery("#meme").click(function(){
			$(this).parents(".specialistContainer").find(".twistyContent").toggle();
			$(this).find("span").remove();
			$(this).prepend("<span>-</span>");
		}); 
});


...

<div style="display:none;">
    <div class="specialistContainer">
        <h5>Company name</h5>
        <div class="twistyContent">
            123 street
            <br/>
            Lotherton Way
            <br/>
            Garforth
            <br/>
            Leeds
            <br/>
            LS25 4GB
            <br/>
            0113 287 2222
        </div>
        <a href="mailto:companyemail" style="color: #000;font-weight: bold;">info@companyemail.com</a>
        <br/>
        <a href="http://www.companyurl.com" target="_blank" alt="Paul Turner Signwriters" title="Paul Turner Signwriters" style="color: #000;">www.companyurl.com</a>
    </div>
</div>
What am I doing wrong!??!
sethwb is offline   Reply With Quote
Old 09-28-2009, 07:07 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
See #2:

http://www.codingforums.com/postguide.htm
__________________
Fumigator is offline   Reply With Quote
Old 09-29-2009, 03:22 PM   PM User | #3
sethwb
Regular Coder

 
Join Date: Aug 2008
Posts: 105
Thanks: 9
Thanked 0 Times in 0 Posts
sethwb is an unknown quantity at this point
Ok to anyone seeking the answer:

My problem was different. I found out from a little more investigation the page is dynamically copying the HTML from a hidden portion of the page, & inserting it as new HTML of a newly created element. That is why the event handler's were not being attached to the proper element and thus not registering clicks.

the code above needs some minor tweaks but it works if youre using those names
sethwb is offline   Reply With Quote
Reply

Bookmarks

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 10:42 AM.


Advertisement
Log in to turn off these ads.