Mark Gerryl Mirandilla
Mark Gerryl Mirandilla

Reputation: 823

html element in placeholder

I have this input

<input class="form-control input-lg" type="text" placeholder="Name" name="name">

Since my form has no labels and I depend on placeholder, is it possible to put an element like

<sup>*</sup>

so that I can show to the users that this field required.

I tried but it didn't work.

Is there a way to do that?

my form

http://www.itbotics.com/contact.php

Upvotes: 1

Views: 517

Answers (2)

Dinnu Buddy
Dinnu Buddy

Reputation: 399

if you dont want to use label:

css code:

.required::before {
    content: "*";
    color:red;
}

html code:

<span class="required"></span>
<input class="form-control input-lg" type="text" placeholder="Name" name="name">

Upvotes: 0

Pixelomo
Pixelomo

Reputation: 6737

Use a label:

<input class="form-control input-lg" type="text" placeholder="Name" name="name">
<label for="Name">*</label>

or you could add * after the placeholder text. any reason for not using labels? they're good practice

Upvotes: 1

Related Questions