0

Is it posible to make different text colors in placeholder: For example I wan't to make placeholder like:

 <input id="place" name="place" type="text" placeholder="" class="form-control input-md" required="">

   <script type="text/javascript">
                                var placeholder = "place for drilling <span>*</span>" ;
                                $('#place').attr('value', placeholder);

                                $('#place').focus(function () {
                                    if ($(this).val() === placeholder) {
                                        $(this).attr('value', '');
                                    }
                                });

                                $('#place').blur(function () {
                                    if ($(this).val() === '') {
                                        $(this).attr('value', placeholder);
                                    }
                                });
    </script>

Why i put this star in * tags because I wan't to make text black color and star red to show that this field is required. But i didn't find a way to put html in placeholder and my version is not working. you can see it on imgenter image description here

So my complete question is: How to make different text color's in one placeholder??

sanchahous
  • 181
  • 6
  • 17

1 Answers1

1

You can define in css like this and go from there

::-webkit-input-placeholder { /* WebKit browsers */
    color:    #888;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    color:    #888;
    opacity:  1;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
    color:    #888;
    opacity:  1;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
    color:    #888;
}
Tremmillicious
  • 454
  • 4
  • 14