Element.value和Element.getAttribute之间的差异(“value”) [英] Difference between Element.value and Element.getAttribute("value")
本文介绍了Element.value和Element.getAttribute之间的差异(“value”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
区别在于 element.value
是实时的,如果用户更改说明,则输入文本框,将反映出来,并向您显示新值。
getAttribute('value')
仍将显示原始的 value =whateverWasHere
值。
I'm just wondering what the difference is between the two. I have noticed the two methods give different results at times.
解决方案
The difference is that element.value
is real time and if a user changes let's say, a textbox input, it will reflect that, and show you the new value.
While getAttribute('value')
will still show the original value="whateverWasHere"
value.
这篇关于Element.value和Element.getAttribute之间的差异(“value”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文