Getting Textbox value in Javascript

前端 未结 6 2177
执念已碎
执念已碎 2020-12-02 00:06

I am trying to get the value of the textbox in a javascript, but its not working. Given below is the code of my test page

<%@ Page Title=\"\" Language=\"V         


        
6条回答
  •  旧时难觅i
    2020-12-02 01:06

    Since you have master page and your control is in content place holder, Your control id will be generated different in client side. you need to do like...

    var TestVar = document.getElementById('<%= txt_model_code.ClientID %>').value;
    

    Javascript runs on client side and to get value you have to provide client id of your control

提交回复
热议问题