jQuery's val() method change doesn't seem to change the DOM

后端 未结 4 1150
青春惊慌失措
青春惊慌失措 2021-01-18 04:37

Doing $(\"#someId\").val(\"newValue\") doesn\'t change the DOM -- I can retrieve this value with $(\"#someId\").val(), but the element in the DOM s

4条回答
  •  情书的邮戳
    2021-01-18 04:44

    Answer if you are using the firebug, there is a bug in it about updating the dom, you must click the window object to refresh it :)

    Explanation @alex i was reading comments below. on @rsp answer and you seem to confuse the dom with the html tree a dom, is a tree like list of values used to keep track of values. and yes click dom tab, or right click the element in question and then inspect it in dom, values, changes dont show up on firebug, because of security reasons that prevent anything other than a browser to change its values or possibly because fire bug, has got it wrong and they probably working on it :)

提交回复
热议问题