I am using this code but keypress event not working
<script type="text/javascript">
$(document).ready(function() {
$('#txt_tempusername').keypress(function() {
var href = $('#providerurl').val();
href = href.toString().replace("{username}", $('#txt_tempusername').val());
$('#btn_idgo').attr('href', href);
});
});
</script>
and this is my HTML
<div class="Input_Div">
<input type="text" id="txt_tempusername" />
<a class='example1demo' id="btn_idgo">Go</a>
<input type="hidden" id="providerurl" />
</div>
Working sample here: http://jsfiddle.net/ezmilhouse/6zfw8/2/
Guess the events worked fine but your 'href' treatment didn't work because the hidden fields value was not defined.
Fixed your code the way I think you wanted it to work:
your html:
<div class="Input_Div">
<input type="text" id="txt_tempusername" />
<a class='example1demo' id="btn_idgo">Go!</a>
<input type="hidden" id="providerurl" value="http://provider-url-{username}.html" />
</div>
your js:
$(document).ready(function() {
$('#txt_tempusername').keyup(function() {
var href = $('#providerurl').val().replace("{username}", $(this).val());
$('#btn_idgo').attr('href', href);
});
});