How can I set the value of a textbox to user entered value.
For ex
<input type = "text" name = "somename" value = "">
If the user enters “3” then it should become
<input type = "text" name = "somename" value = "3">
All I want is that when I process the textbox for value in a servlet, I should be able to get the value 3 for that textbox. well, there is more to it as David says. The textbox is part of a cart application and it denotes quantity of an item. What I want to do is to be able to take the value of any item and store it in the database. I will have a default value of 1 for every textbox. But when I POST the data, I want it to post the value entered by the user and not the default value
The value in the textbox is automatically transferred to the server when you submit the form as
somename=3(or whatever value).However, if you want to actually update the
valueattribute of the element, you could use jQuery to do something like:HTML
jQuery
Javascript
(untested, but might work if you don’t want to use jQuery)