I am working with a plugin to add or lower a post. I am trying to force the work on an alternate click on anchor tag. Here is the html markup
& lt; Div class = "voter" & gt; & Lt; One class = "vote_ added" data-id = "25" & gt; Vote & lt; / A & gt; & Lt; One square = "vote_down" data-id = "25" & gt; Vote & lt; / A & gt; & Lt; / Div & gt;
Here is javascript
jQuery ("voter A: first-child"). ("Click", function () {if (.jQuery (this) .hasClass ('vote_added') {console.log ("click"); var data = jQuery (this) .data (); console.log ( Data); votemeaddvote (data.id); jQuery (this) .removeClass ('vote_added'); jQuery ('voter one: last-child'). AddClass ('vote_down');} and {jQuery (this). Off (); console.log ("Turning off - - vote for feature");}}); ("", "Click"); ("Click", function () {if (jQuery (this) .hasClass ('vote_down') {console.log ("click"); var data = JQuery (this) .data (); console.log ( Data); weightedevavote (data.id); jquery (this) .removeClass ('vote_down'); jQuery ('voter a: first-child'). AddClass 'Vote_added');} Other {jQuery (this) .off (); Console.log ("Turnig off --- Voting feature");}});
This code is only working for one time because I .off (); I'm separating events using the
function. I want
if I click on the vote vote feature.
1) It should run a function (votemeaddvote (data.id)); 2) If I click it again, then it should be disabled
If I click on the down vote feature
1) It should run the function (votemedownvote (data.id)); 2) If I click it again, then it should be disabled. 3) It should work on adding the vote panel, if I click on adding vote after clicking the poll.
This functionality is very similar as in the boredpanda.com I am trying to implement the voting system in the same way for the front end.
No comments:
Post a Comment