I have a series of forms in my html, the intention is that when the user clicks on the "continue" button, the current one disappears and the next one shows up. However I was wondering if there is a way of getting which "continue" button was pressed (that is, of which form) so to just have a piece of code that basically checks and hides the current form and shows up the next one without requiring id's or such.

I tried a couple of things but none worked so I won't be posting here the code (it honestly just "broke" the website anyways.

That'll handle hiding and showing the forms for you too. It assumes your buttons are either <button> or <input type="submit">, and your form elements are within the same parent.

Of course, if you have buttons elsewhere on the page which don't have this behaviour, then you need to add a class such as formContinue to your buttons of interest, and change the third line in the code above to:

quick question, if "form:first" gets me the next sibling, how can I get ahold of the previous one?
–
TsundokuAug 9 '10 at 4:12

sorry, my mistake, siblings("form:first") will get you the first form in the series. To get the previous or next form use thisForm.prev() and thisForm.next(). If you have other elements between forms then use thisForm.prevAll("form:first") and thisForm.nextAll("form:first"). I've updated my answer to show this.
–
Box9Aug 9 '10 at 4:30

Simplest might be to give each such "continue button" a different id, which makes it trivial to identify (e.g. you could have the id be the form's id concatenated with the string '_cnt' or the like). But if you're using jquery, the .parent() method lets you trivially-easily find an object's "parent", so in that case I'd recommend just making the continue buttons immediate children of their respective forms. (If you're not using some good JS framework, like the popular jquery, to tide you across browser incompatibilities &c, consider doing so... they're really useful!-).