Anyname Donotcare Anyname Donotcare - 1 year ago 130
HTML Question

How to pass the text box value as a part of href

I try to pass text box value as a part of link

href
query string like this :

<asp:TextBox ID="txt_reg" runat="server"></asp:TextBox>

<a target="_blank" href="Schedule.aspx?nav=<%=txt_reg.Text %>" >ENTER</a>





But i get no value in
nav
parameter !

What should i do to pass the textbox value as a part of link ?

Answer

Try this

<input type=text id=txt_reg />

 <a target="_blank" href="" onclick="this.href='Schedule.aspx?nav='+document.getElementById('txt_reg').value" >ENTER</a>