Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a default value for "input type=text" without using attribute 'value'?

Tags:

html

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.

like image 881
q0987 Avatar asked Aug 31 '10 15:08

q0987


People also ask

What is the default type of type attribute of input element a text?

What is the default type of 'type' attribute of <input> element? Explanation: Text input type defines single line text field. Type is the attribute that displays type of <input> elements. Its default type is text.

What is the default value of type attribute of input element?

The default type of <input> type attribute is text.

What is a default value to a text box?

The DefaultValue property specifies text or an expression that's automatically entered in a control or field when a new record is created.


1 Answers

You should rather use the attribute placeholder to give the default value to the text input field.

e.g.

<input type="text" size="32" placeholder="1000" name="fee" /> 
like image 189
Arjun Tuli Avatar answered Sep 20 '22 22:09

Arjun Tuli