tags:

views:

516

answers:

1

Hi,

I currently have a page with four list boxes on it and imagine a button alongside each one, say:

List 1 List 2 List 3 List 4

I also have a <"div#formEntry"> that holds a form with text fields, for users to enter information in.

My question is, depending which button I have pressed, I would like to slideDown this div immediately after the button I have pressed.

So if I have pressed , slideDown div between List 2 and List 3 etc.

Any help would be appreciated.

Thanks. Tony.

Just some further info to clarify my requirement:

  • List 1
  • List 2
  • List 3
  • List 4

Based on this list, if I press , I would like my form <"div#formEntry"> to appear immediately below List 2, under the list item and to the left and not under the button.

+1  A: 
$("button selector").click(function() {
    $("#formEntry").insertAfter(this).slideDown();
});

Clicking any of the buttons will move the form after the button and slidedown. Is this what you wanted?

Philipe Fatio
thanks for that - exactly what I was after. will try it out and let you know how I get on.
tonsils
I tried it - almost what I want but I would actually like the div inserted under the listbox item and not the button itself. Hope this makes sense.
tonsils
`$("button selector").click(function() { $("#formEntry").insertAfter(this).parent().slideDown();});`I inserted a `.parent()` above, depending on your markup you may have to insert various `.parent()` until you reach the listbox.
Philipe Fatio