我已經搜索了其他類似的問題/答案,但似乎沒有人爲我工作。 我試過每一個組合(文本,innerHTML,jQuery,html),使其工作沒有成功。.innerHTML不會修改頁面中的內容
的Javascript:
if (store.indexOf(nome) > -1) {
if (righe+incrementi < 30) {
posizionamento = store.indexOf(nome);
var incrementa = parseInt(document.getElementById('quantity'+posizionamento).innerHTML);
incrementa ++;
document.getElementById('quantity'+posizionamento).innerHTML = incrementa;
incrementi = incrementi+1;
var settam = document.getElementById('count').innerHTML;
var tipo = document.getElementById(posizionamento).getAttribute('data-tipo');
if (tipo === "water"){
settam++;
document.getElementById('count').innerHTML = settam;
alert(settam); }}}
HTML代碼:
<div id="conteggio">
<div class="titoli">Elements:</div>
<span style="display: none" id="counttxt">
<span class="conteggio">Count</span>
<span class="count" id="count"></span>
</span>
</div>
我惹毛了這一說法,警報工作正常(顯示右INT),但沒有的innerHTML不改變,同時其他工作正常(增量++; [...]。innerHTML =增量;;) 在鉻和safari測試。 在Firefox中它會改變,但是在我關閉警報之後,它將「值」設置回先前的「值」。
我在做什麼錯了?
什麼是喜歡你的HTML代碼?所以我們可以看看你現在編輯的'count'元素 – Lixus
! –
我喜歡以'else if'開頭的問題:D:D讓我想知道♪;)請嘗試創建一個[mcve] –