Ah, of course Matt, I apologize, here ya go :)
$("div.vote_for_selected").click(function(){ //first load content $("div.divvoteinto").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 to reflect the new vote $(this).removeClass("vote_for_selected"); $(this).addClass("vote_against_selected"); //$("vote_for_selected vote_against_selected").removeClass("vote_for_selected"); }); $("div.vote_against_selected").click(function(){ //first load content $("div.divoteinfo").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 to reflect that the user has just submitted a vote $(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"); }); Ok, here when a user clicks on div.vote_against_selected, it is changed to div.vote_for_selected, and vice versa. I am binding the click function to each of these classes, yet after I call the ajax request, I cannot use the .click() on the other element. The ajax request is working great, yet I can only use it on one of the <divs> On Jul 29, 6:26 pm, "Matt Stith" <[EMAIL PROTECTED]> wrote: > Some code samples would really be helpful here. You can copy any paste, just > change any info like URLs that you dont want us to know. Its hard to > describe a block of code using a paragraph of text :P > > On 7/29/07, Jim Newfer <[EMAIL PROTECTED]> wrote: > > > > > Hello everyone, > > > I am quite new to jquery but love its ease of use! I have all the > > basic functions down pat, although I am struggling with the load() > > function, what appears to be quite simple is very puzzling to me. > > > To provide an example of what I am trying to accomplish via jQuery can > > be found here, jyte.com the main vote buttons. A user can toggle his/ > > her votes as many times as they want. When the user clicks on the vote > > button on the right, a css class is added to that button. When the > > vote button is clicked on the left, a css class is added to that > > button. This is all done via the .click() function. Also on click() I > > am calling an ajax request (I should not I am not actually loading > > anything into the page, but the ajax request is working, but only for > > that single button. As soon as I change the class of the button, I can > > no longer click on that, even though I have specified ANOTHER function > > in jQuery specifically for that class I just added. > > > I have searched the group so far and I have found a little bit about > > adding a new .click() to your added class. Although this means that if > > I want to let the user change the votes as many times as they want, I > > would need to right the .click() function 100 times over to allow the > > user to click on it again! > > > Could someone please point me in the correct direction or offer some > > advice? Thank you, I appreciate your time. > > > Sincerely, > > Jim