q0987 q0987 - 3 months ago 10
HTML Question

HTML - How to define a default value for INPUT TYPE=TEXT without using attribute 'value'

I need to give a default value for input type=text field as follows:

<input type="text" size="32" value="" name="fee" />

There is one way to give this default value as I know:

<input type="text" size="32" value="1000" name="fee" />

Here is the question: Is it possible that I can set the default value without using attribute 'value'?

As I know, if I set the enter the value 1000 manually, and then view the source through web browser the value is still empty. So I think there may be a method that I can use.

Thank you


You can use Javascript.

For example, using jQuery:


However, this won't be any different from using the value attribute.