Question

I can't seem to figure out what is over writing the placeholder in this specific input box on a colour picker, I have a placeholder as":

placeholder="Type a hex (Or keyword)"

It's defaulting as "#FFFFFF" has anybody any idea why? I've tried to change both the value and placeholder of the input box and still nothing changes.

Was it helpful?

Solution

It's being injected by javascript.

Try value="Type a hex (Or keyword)"

I'm not sure if this will work, it depends on the JS script of the colorpicker.

OTHER TIPS

Your placeholder is not been showed because there is a value defined!

Placeholders are placeholders. They are there only when inputs are empty (value=="")

Set your default value as "" and it will work.

@Companjo is correct, it is in fact because the javascript for your colorpicker is overriding the value. jscolor is written to automatically change the input when it's loaded. If you want to make a change a specific element's placeholder back to its original value you can update the init function in jscolor.js as so:

init : function() {
  if(jscolor.binding) {
    jscolor.bind();
  }
  if(jscolor.preloading) {
    jscolor.preload();
  }
  document.getElementById('nobg').value = '';  // this is the only new line
},
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top