I am trying to replace the add favorite button with CSS-ONLY buttons, so instead of the star image
having a FAVORITE and UNFAVORITE buttons, when the button is clicked his value changes to unfavorite, then changed back to favorite if clicked again ( like twitter follow btn)
so instead of the star i added a "favorite" value to the input box and kept the icon on the left, and it looks nice ( the green button)
HTML after adding Value :
<input type="submit" class="qa-favorite-button" id="favbtn" value="Favorite" onclick="return qa_favorite_click(this);" name="favorite_Q_61_0" title="Remove this question from my favorites">
now when i click on favorite , the button value don't change. fair enough, i need to add some javascript.
i noticed that favoriting button class changes to "qa-unfavorite-button" if we favorite the question, so i though this script will make it ,
if ($(favbtn).hasClass("qa-unfavorite-button")){
var e = document.getElementById('favbtn')
e.value="unfollow";
}
i added it to qa_favorite_click function to page.js file and nothing Happend :( , i tried various variation but in vain
I am doing it wrong ? i am putting the code in a wrong place ?
Help me please