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 10-30-2008, 11:54 AM   PM User | #1
FunkyORACLE
New Coder

 
Join Date: Oct 2008
Location: Essex
Posts: 22
Thanks: 2
Thanked 1 Time in 1 Post
FunkyORACLE is an unknown quantity at this point
jQuery object with variable id name. Is is possible?

Hi,
is it possible to passed the jQuery object a variable with the the js functions for example?
I'm having problems with jQuery. I have an img that on click it runs this function however nothing gets hidden or shown.

I have the following in my page header

Code:
function hide_Show(RegionID) 
   var $jQuery = jQuery.noConflict(); 
//Icon that is clicked 
   var objectClickedID = '#' + RegionID + '_img'; 
//Region to hide 
   var objectID = '#' + RegionID; 
   $jQuery(document).ready(function(){ 
      $jQuery(objectClickedID).click(function() { 
        if ($x(objectID).style.display =='none') { 
          $jQuery(objectID).show('slow'); 
        } 
        else{ 
          $jQuery(objectID).hide('slow'); 
        } 
      }); 
}
and my img is as following

Code:
<img id="show_hide_img" onClick ="hide_Show('show_hide'):" alt="Click here to expand/collapse this section" style="cursor: pointer;" src"plus.gif" />
and my region that I want to hide is
Code:
<div id="show_hide">Hide this</div>
I know you might say that I could just hard code the div ID though I have a lot of divs and they img's need to hide specifc divs.


Thanks for your support.
FunkyORACLE 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:36 AM.


Advertisement
Log in to turn off these ads.