We would like to know how to append string to a string in input type="text" field.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.10.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!-- w w w . java2 s .c o m-->
$("#button").click(function(){
var value = $("#text").val();
value += ".html";
$("#text").val(value);
var fileName = $("#text").val();
document.writeln(fileName);
});
});
</script>
</head>
<body>
<input type="text" name="text" id="text">
<input type="button" id="button" value="Click">
</body>
</html>
The code above is rendered as follows: