Adding a Label Inside an Input Field in HTML

Check out this JSFiddle link ( for Solution 2. Alternatively, you can try this solution by implementing CSS and HTML. For Solution 3, position the label over the text area and add top padding to the textarea. Don’t forget to add the CSS class. See this example for reference. The code for Solution 2 was almost correct, but you just need to add quotes around the text in an ASP Label since it’s output raw to the response stream.


There is a problem with the syntax of the code on the mentioned lines.

qtyLabel.innerHTML = "Qty: ");
colorLabel.innerHTML = "Color: ");

Just alter to this:

qtyLabel.innerHTML = "Qty: ";
colorLabel.innerHTML = "Color: ";

Perhaps that is why it functions when you leave a remark on them.

Frequently Asked Questions