Having trouble with jQuery toggle row to work right

The results appear in a table and each row when clicked on shows detailed information.  I'm trying to use the jQuery toggle so it can open the detail information under the persons name.
The jQuery code I have is this...
<script>
$(document).ready(function() {
     $("#title").click(function() {
     $("#detail").toggle();
</script>
Then my cfoutput table is this...
<table>
<thead>
<tr><th>First Name</th></tr>
</thead>
<tbody>
<cfoutput query="getRecords">
<tr>
<td id="title">#getRecords.firstN#</td>
</tr>
<tr>
<td id="detail"><cfdiv bind="url:details.cfm?firstN=#firstN#" /></td>
</tr>
</cfoutput>
</tbody>
</table>
Now what happens with that is all the detail records show up with the name and only the first row can toggle.  Everything else doesn't do anything.  Also is there a way to have the toggle show as closed first?  Thank you so much for any help with this.

This is because you are referencing an ID with jQuery. An ID has to be unique, only one can exist, and after you create multiple cells with the same ID, jQuery just takes the first one.
You will be better off using a class instead. So you can change you jQuery to look like this:
$(document).ready(function() {
     $(".title").click(function() {
          $(this).parent().next().find('td').toggle();
This will get the current clicked cells parent row, then go to the next row and look for the cell, then it will toggle.
You then need to change your HTML to be something like this:
<cfoutput query="getRecords">
    <tr>
        <td class="title">#getRecords.firstN#</td>
    </tr>
    <tr>
        <td class="detail"><cfdiv bind="url:details.cfm?firstN=#firstN#" /></td>
    </tr>
</cfoutput>
If you want to hide the detail cell first you can add some CSS to the detail class like so:
.detail {
     display:none;
Here is an example of it all - JSFiddle

Similar Messages

  • I am having trouble with face time , it was working well yesterday and today am not able to use it due to an error that won't let me log in !!!

    I am having trouble with face time , it was working well yesterday and today am not able to use it due to an error that won't let me log in !!!

    I have the same exact issue. There is number of these post, but still not an answer. hope someone post an answer soon

  • Having trouble with the move tool not working....   also I cannot seem to crop.... my cloud says I'm up to date, should I

    I seem to be having all kinds of trouble with Photoshop CC2015 and CC as well.... I cannot use the move tool.
    Also have a heck of a time cropping, will not let me select a crop, are there glitches I'm not aware of???

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Having trouble with report total row with expression based condition

    Hi,
    I have a simple SQL region that has 2 columns (country and pnl). I then had a request to display negative PNL in red. To do this I copied the Standard Alternating Row Colors report Template and changed the condition so that it uses one class (named "t16data") with a PL/SQL Expression condition NVL(#PNL#,0)<0
    Then, in the referencing page HTML header I added :
    <style>td.t16data{color:red} </style>
    For normal data rows it works fine. However, I also have a sum on PNL and the total row always shows red (even when it's a positive number).
    Any idea? Do I need to provide more information?
    Thanks

    My question about this is the other Dynamic VPN that is working has no static route.
    I added:
    route outside 10.10.10.0 255.255.255.248 xxx.xxx.xxx.xxx (where xxx.xxx.xxx.xxx is the IP of the non working remote IKE Peer)
    This had no effect.
    Looking at the two tunnels.  The working tunnel is using IKE IPSEC and the nonworking tunnel is using IKE IPsecOverNatT.  What have I entered that tells the VPN to use IPsecOverNatT?

  • Is anyone else having problems with the overdrive app not working right after new apple update

    I am having problems with the overdrive app.  I am only allowed to read about twenty pages of a book and then it tries to load more pages but does not.  I have reinstalled the app but have the same problem. Any ideas.

    Have to talked to the developer? Gone to their site? Do they have an update out for the newer OS?

  • I am having trouble with a LaCie 526 monitor working with my new Mac Pro.  When I boot up, I see the sign-in screen for a second, then it disappears, reappears with some of the screen pixelated and the spinning beach ball -- and then freezes. Any thoughts

    The LaCie is connected via DVI to thunderbolt adapter.  It had been working, and then when I switched off the computer and restarted several days later, I see the signon screen flash quickly, followed by nothing, followed by the signon screen and spinning beach ball and it simply freezes.  Any thoughts?

    When you have kernel panics, the pertinent information is in the panic report.
    These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ System Diagnostic Reports
    (not Diagnostic and Usage Messages) from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar.
    There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of reports. A panic report has a name that begins with "Kernel" and ends in ".panic". Select the most recent one. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
    If you don't see any reports listed, but you know there was a panic, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report.
    I know the report is long, maybe several hundred lines. Please post all of it anyway.

  • I am having trouble with iMessage being activated. It has worked up until yesterday and now won't activate and is saying no address in the send and receive section. My number is there but not ticked. Any suggestions on how to fix this?

    I am having trouble with iMessage being activated. It has worked up until yesterday and now won't activate and is saying no address in the send and receive section. My number is there but not ticked. Any suggestions on how to fix this? I have shut down my phone, but still no luck!

    iMessage and FaceTime went down yesterday for some people. Mine is still down. My iMessage is saying the same thing about being activated. Sounds like you are still down too. Ignore the status page that says everything is fine - it lies.

  • I'm having trouble with back to my MAC.  I had everything working on my home wifi network but now I am at my daughter's house and trying to connect via a verizon hotspot wifi connection.  I'm wondering if the Verizon hookup is a problem.

    I'm having trouble with back to my MAC.  I had everything working on my home wifi network but now I am at my daughter's house and trying to connect via a verizon hotspot wifi connection.  I'm wondering if the Verizon hookup is a problem.

    I finally figured it out.  Needed to update her Airport firmware and allow guest access, and also changed Sharing preferences to Allow Access for All Users.

  • EntaOk, I am atuallually having troubles with my itunes music card. I accidlly scratched a letter off. i want to get my card to work. how? thank you.

    Ok, I am actually having troubles with my itunes music card. I accidentally scratched off a letter. how can i get my card to work without the actual code? thank you.

    Yu can try contacting iTunes. See the iTunes Cards abd Code topic of:
    Apple - Support - iTunes

  • I am having trouble with my iPad, i can start it, but the iPad does not work. i tried to use the power and home button at the same time, the apple logo appears, but the iPad does not work. What am I suppose to do?

    I am having trouble with my iPad, i can start it, but the iPad does not work. i tried to use the power and home button at the same time, the apple logo appears, but the iPad does not work. What am I suppose to do?

    After the Apple logo appears, what happens then? Can you hear any sounds or if you tap on the screen, does it seem like apps can open or are you just seeing a black screen? You might have a hardware problem, but you can try restoring the software and see what happens.
    Read this in its entirety before you do anything. Make sure you read the sections at the end about using recovery mode.
    iTunes: Restoring iOS software - Support - Apple

  • Hi friends, I'm having troubles with my Ipad 2. I was working with it and suddenly the screen distorted. Now it is not possible to get it back to work properly. In fact, the screen is now black and nothing I have done makes the Ipad works again. Thanks

    Hi friends, I'm having troubles with my Ipad 2. I was working with it and suddenly the screen distorted. Now it is not possible to get it back to work properly. In fact, the screen is now black and nothing I have done makes the Ipad works again. Please Help. Thanks in advance.

    I think you should make an Genius Appointment.
    Genius Appointment
    http://www.apple.com/retail/geniusbar/

  • I'm working with Illustrator CS5 and am having trouble with basic graphics textures.

    I'm working with Illustrator CS5 and am having trouble with basic graphics textures. The illustrator drawings look fine with the pattern fills and when I bring the drawing into quark 9.1 they are still fine. When I print the quark file to lo res pdf drawing is still fine, but when I print to hi res pdf (press quality for print) the patterns disappear. I cannot figure out what the problem is.
    just a note. Other textures and artistic fills work fine. It seems to be just the basic ones. I'm wondering if for some reason they may not be saved completely in my libraries?

    Its just a drawing in black and white with some basic graphic texture to show “dirt”  The pattern consists of a bunch of small lines. I save the file as an eps. And bring it into quark.  When I print from quark I say print to pdf as press quality. I don’t think the problem has to do with acrobat because I’ve never encountered these problems before CS5. These drawings have been around for years and all of a sudden they don’t work.
    Does this help?
    Cath
    Graphic Specialist
    [email protected] 905-403-8658 x297
    P Is it necessary to print this e-mail?

  • Has anyone else been having trouble with safari ever since the update? I have restarted several times,mans it still doesn't work.

    Has anyone else been having trouble with safari ever since the update? I have restarted several times, it still doesn't work.

    Greetings Blueleoapple,
    After reading your post, it sounds like you are experiencing an error with Safari. You may want to consider resetting your device, which is different from restarting. This article provides detailed instructions for Restarting, and Reseting:
    Restart or reset your iPhone, iPad, or iPod touch - Apple Support
    How to restart
    Press and hold the Sleep/Wake button until the red slider appears.
    Drag the slider to turn your device completely off.
    After the device turns off, press and hold the Sleep/Wake button again until you see the Apple logo.
    How to reset
    You should reset your device as a last resort and only if you can't restart it.
    To reset, press and hold both the Sleep/Wake and Home buttons for at least 10 seconds, until you see the Apple logo.
    Thank you for contributing to Apple Support Communities.
    Best,
    Bobby_D

  • Im having trouble with my ipad wifi connection my mac air has no issues but ipad not working

    hello,
    Im having trouble with my wifi connection.
    Ive reset the router, reset all my connections, still no good.
    It keeps spinning when trying to connect
    my mac air and other apple products are fine on same internet connection
    the cellular connection works just having issue with ipad3

    i did the reset of network settings.. still no good. recently upgraded to new os 6.1 version any way to go back to older version of os?

  • I'm having trouble with my iCloud photos. I thought i could be a little sneaky and take a photo of my photos that were more than 30 days old, so they would be uploaded along with my new photos. that part worked, but i can't upload them to Snapfish?!

    i'm having trouble with my iCloud photos. I thought i could be a little sneaky and take a photo of my photos that were more than 30 days old, so they would be uploaded along with my new photos. that part worked, but i can't select them to upload them to Snapfish?! Any thoughts? I'm bummed. I've got a few hundred photos on my iPhone that I'd like to move seemlessly - or somehow at all.

    hopefully something in here is helpful?
    http://support.apple.com/kb/HT4486

Maybe you are looking for