queryselector 返回的是element

queryselectorall返回是nodelist

(function () {
        var btn = document.querySelector('#btn');
        var text = document.querySelectorAll('#textInput')[0];
        btn.addEventListener('click',function (e) {
            var num = text.value - 0;
            num ++;
            text.value = num;
            console.log(text.value);
        })
    })(); 

你可能感兴趣的:(queryselector 返回的是element)