Hm, I don't quite exactly understand what you are saying. I simply
load into the div.fake because I do not want any data loaded. But
firebug DOES show an ajax action taking place everytime I click that
element, allowing me complete the ajax request. Thank you for your
post though, I will look into it right away.

Vince

On Jul 28, 9:36 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> inVINCable wrote:
> > 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:
>
> If div.fake doesn't exist, the line
>
> $("div.fake").load("/stories/vote/1/" + $storyid);
>
> doesn't do anything, so you could as well delete it. I don't understand
> what you're trying to achieve here.
>
>
>
> > $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 :(
>
> The click event wasn't bound to the element with the changed class in
> the first place. jQuery result sets are not live. You bound the event to
> all elements with a certain class at that time, but if another element
> will be changed later on to belong to that class as well, that doesn't
> automagically bind that event handler as well.
>
> The behaviour plugin may be of some interest, see 
> FAQ:http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...
>
> as well as this tutorial:http://docs.jquery.com/Tutorials:AJAX_and_Events
>
> --Klaus

Reply via email to