I have a function where you can click to like, and you kan also click to dislike. How can I make it NOT possible to go to negative number, so that if you click dislike after 0 it stays 0?
function stem(id) {
var antal_stemmer = document.getElementById(id).className;
var nyt_antal_stemmer =+ antal_stemmer + +1;
document.getElementById(id).className = nyt_antal_stemmer;
var indhold = document.getElementsByClassName(id);
var indholdA = indhold[0].innerHTML;
indhold[0].innerHTML = nyt_antal_stemmer + " stemmer";
}
function fjern(id) {
var antal_stemmer = document.getElementById(id).className;
var nyt_antal_stemmer =+ antal_stemmer - +1;
document.getElementById(id).className = nyt_antal_stemmer;
var indhold = document.getElementsByClassName(id);
var indholdA = indhold[0].innerHTML;
indhold[0].innerHTML = nyt_antal_stemmer + " stemmer";
}