How to change the value of an asp:textbox from javascript

前端 未结 4 1129
故里飘歌
故里飘歌 2021-01-06 23:48

I have an asp:textbox


and when a user clicks the \"Cancel\" button, I want to erase w

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-07 00:19

    renders to an which you can use as you would, the only complication is the id="" attribute is rewritten, but you can do this:

    document.getElementById("<%= NewName.ClientID %>").value = "";
    

    Assuming that this script is in the same page as the textbox. If this is in a referenced

提交回复
热议问题