Hello everyone,

I am just about ready to throw my darn computer out the window
here :P.

What I am doing is quite simple, I am using the .load() function to
call upon a function, like so:

$("div.vote_against_selected").click(function(){
//first load content
$("div.fake").load("/stories/vote/1/" + $storyid);

)};


I should note that div.fake does NOT exist, as I do not want anything
loaded, because I change the div myself, via the .html() function,
like so:


$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);


That works fine and dandy as well! Now, at the very end of my .click()
function, after the load, and the .html() functions have taken place,
I remove and add a class like so:


$(this).removeClass("vote_against_selected");
$(this).addClass("vote_for_selected");


Again, this works perfect! I even look at look at the code with
firebug, and the classes are removed, and added, which is what is
exactly what is supposed to happen. But here is the kicker, I have
another function that does the EXACT same thing, but is for the
vote_for_selected. You will notice right above I used the addClass on
the vote_for_select above, like this:

$(this).addClass("vote_for_selected");

Again, after looking at the source and verifying that the change was
made, I try clicking on the new class (that was changed from
vote_against_selected, to vote_for_selected when a click on
vote_against_selected took place) but NOTHING happens! Ah, and I
cannot understand why because looking at my source, the class is
changed, so why isn't jquery recognizing this change!

Any tips/pointers/advice on where to go from here or any functions to
look at are greatly appreciated! (Btw I have use the bind() function
in every possible combination but nothing seems to work :(


Sincerely,
Vince

Reply via email to