I have an input button. I created for this input an attribute called "multiplicateur" which has the value of 1. When the button is clicked I have a .click()
triggered. The function is suppose to get the value of the attribute and add 1 to it. So my output should be 2. Instead the output is 11. It seems the system makes a concatenation instead of an addition.
My HTML:
<input id="envoyer" type="submit" multiplicateur=1>
My JS:
$('#envoyer').click(function() {
var ajaxData = $(this).attr('multiplicateur');
alert(ajaxData + 1);
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…