Matt:
Ah, of course ! Here ya go ;)
$("div.vote_against_selected").click(function(){
//first load content
$("div.storyinfo").load("/stories/vote/1/" + $storyid);
//then set up new value to display
$first_new_votes_for = $votes_for * 1 + 1;
$first_new_votes_against = $votes_against * 1 - 1;
if ($first_new_votes_against == "") {
$first_new_votes_against = "0";
}
$("h3.votenumberfor").html($first_new_votes_against);
$("h3.votenumberagainst").html($first_new_votes_for);
//then we change the classes
$(this).removeClass("vote_against_selected");
$(this).addClass("vote_for_selected");
//$("div.vote_against_selected").addClass("div.vote_for_selected");
//$
("div.vote_against_selected").removeClass("div.vote_against_selected");
});
$("div.vote_for_selected").click(function(){
//first load content
$("div.fake").load("/stories/vote/2/" + $storyid);
//then set up new value to display
$new_votes_for = $votes_for * 1 - 1;
if ($new_votes_for == "") {
$new_votes_for = "0";
}
$new_votes_against = $votes_against * 1 + 1;
$("h3.votenumberfor").html($new_votes_for);
$("h3.votenumberagainst").html($new_votes_against);
//then change the classes
$(this).removeClass("vote_for_selected");
$(this).addClass("vote_against_selected");
//$("vote_for_selected
vote_against_selected").removeClass("vote_for_selected");
});
Ok, here are my two .click functions, as you can see, when a user
clicks to vote against the post, the class is changed, and vice versa.
The only problem is that I can only click the .div() once, :(
Any help, and/or advice is GREATLY appreciated!
Thank you :)