[jQuery] Nubee - concatenating & code help
First of all, is it possible to concatenate events with similar (the
same) functions?
For example:
$(".closerbutton").show("slow");
$(".editbutton").show("slow");
...would be like $(".editbutton", ".closerbutton")... I know that's
not possible, but is there another way?
I also need help with a script.
$(function() {
$(".portfolio").click(function() {
$(".jq").load("/portfolio/", function() {
$(this).slideDown("slow"); });
$(".closerbutton").show("slow").attr("title", "close");
$(".editbutton").show("slow").attr("title", "edit");
$(".editbutton").click(function() {
$(".jq").load("edit.php?edit=portfolio", function() {
$(this).slideDown("slow");
});
});
});
});
So when someone clicks on .portfolio this will happen:
- load the page & slidedown
- show both close & edit buttons
- if someone click on the edit button it will load the particular edit
page for portfolio.
This works only when there's no <a href> link.
If I provide the link in HTML, it'll load instead of this jQuery
script. If I put "return false" before .editbutton click function, it
will work, but editbutton won't be attached to ".portfolio" and will
be generic. For every page I want one edit button that will alter just
that particular page.
I hope I was clear enough for someone to understand! :D Thanks!!