0

Not able to add Asterisk before Placeholder even using placeholder definition Demo is Given Below

HTML:

<input type="text" placeholder="Asterisk Before Placeholder"/>

CSS:

input::-webkit-input-placeholder:before {
  content: '*';
}
input:-moz-placeholder:before { /* Firefox 18- */
  content: '*'; 
}
input::-moz-placeholder:before {  /* Firefox 19+ */
  content: '*';
}
input:-ms-input-placeholder:before {  
  content: '*';
}

See the JSFiddle

Kishor
  • 2,659
  • 4
  • 16
  • 34
Shakeel
  • 1
  • 1
  • 1
  • 2
    Similar question [here](http://stackoverflow.com/questions/24377777/firefox-placeholder-before-css-selector-not-working). – Soubhik Mondal Apr 02 '16 at 15:46

1 Answers1

0

Please try this using Javascript:

var asterisk = "* ",
    inputList = document.getElementsByTagName("input");

for(i=0; i < inputList.length; i++) {
     inputList[i].placeholder = asterisk.concat(inputList[i].placeholder);
}
satya
  • 1,145
  • 8
  • 12