// JS中 innerHTML、innerText、value 的用法区别
1 2 3 | <select id="select"> <option value="1">我是第一个option</option> </select> |
1 2 3 4 | var select = document.getElementById('select'); console.log('innerHTML: '+select.innerHTML); console.log('innerText: '+'\n'+select.innerText); console.log('innerValue: '+'\n'+select.value); |
console结果: