[jQuery] Re: New to Jquery : Using it on dynmaically created divs

2008-10-24 Thread ricardobeat
Using IDs with the solution I proposed above should work: function divShowHide(divID, imgID){ var $divToShow = $('#'+divID); var arrowURL = $divToShow.is(':visible') ? 'downarrow.gif'' : 'uparrow.gif''; // the above is the same as: if ($divToShow.is(':visible')) { arrow = 'downarrow.gif

[jQuery] Re: New to Jquery : Using it on dynmaically created divs

2008-10-24 Thread James2008
I've now got the divs sliding with this very simple code : function divShowHide(divID, imgID){ // Hides/Shows the vehicle details div and changes arrow appearance var divToChange = document.getElementById(divID); var arrowToChange = document.getElementById(imgID); $(divToChange).slideTogg

[jQuery] Re: New to Jquery : Using it on dynmaically created divs

2008-10-24 Thread James2008
Hi again, Jonathan - I have tried that function in replace of my own and it doesn't seem to work :-s Any ideas? Thanks, James On Oct 23, 9:30 pm, ricardobeat <[EMAIL PROTECTED]> wrote: > A more resilient solution is to use class names instead, you can't > just drop/ignore the IDs altogether: >

[jQuery] Re: New to Jquery : Using it on dynmaically created divs

2008-10-23 Thread ricardobeat
A more resilient solution is to use class names instead, you can't just drop/ignore the IDs altogether: Product 8234 (with background-image: url(downarrow.gif) on CSS) bla bla bla bla $('div.title').click(function(){ var arrow = ( $(this).next('.description').is(':visible') ) ? 'url(downarr

[jQuery] Re: New to Jquery : Using it on dynmaically created divs

2008-10-23 Thread Jonathan Sharp, Out West Media
Hi James, Here's one way to rewrite it using jQuery: function divShowHide(divID, imgID) { var d = $('#' + divID).toggle(); $('#' + imageID).attr('src', 'Images/' + ( d.is(':visible') ? 'down' : 'up' ) + 'arrow.png' ); } Cheers, -Jonathan On Oct 23, 2008, at 8:42 AM, James2008 wro

[jQuery] Re: New to Jquery : Using it on dynmaically created divs

2008-10-23 Thread James2008
I forgot to mention. I want to do this so I can use the up and down animations for hiding/showing the divs (as currently there is none using the above method) On Oct 23, 2:42 pm, James2008 <[EMAIL PROTECTED]> wrote: > Hi. At the moment I've creating 2 divs for each record in a database. > One to