In this article I will explain with an example, how to pass (send) TextBox value in HREF of Anchor Link in HTML.
The HTML Anchor Link will be assigned an OnClick event handler and when clicked, the value of the TextBox will be set in the HREF attribute of the HTML Anchor Link using JavaScript.
When the HTML Anchor Link is clicked, the TextBox value will be passed to the other Page as QueryString parameter.
 
 
HTML Markup
The HTML Markup consists of an HTML TextBox and an HTML Anchor Link.
<input type="text" id="txtName"/>
<a href = "javascript:;">Send</a>
 
 
Passing (Sending) TextBox value in HREF of Anchor Link in HTML
The HTML Anchor Link is assigned an OnClick event handler and when clicked, the value of the TextBox is set in the HREF attribute of the HTML Anchor Link using JavaScript.
When the HTML Anchor Link is clicked, the TextBox value is passed to the other Page as QueryString parameter.
<a href = "javascript:;" onclick = "this.href='Page2.htm?name=' + document.getElementById('txtName').value">Send</a>
 
 
Screenshot
Pass (Send) TextBox value in HREF of Anchor Link in HTML
 
 
Browser Compatibility

The above code has been tested in the following browsers.

Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.

 
 
Downloads