2

Possible Duplicate:
CSS :after pseudo element on INPUT field

Here is what I have that I am trying to use to style an input button:

.save:before, input[type="submit"]:before {content: "\2714";}

and here is the HTML that I am trying to style:

<input type="submit" id="edit-submit" name="op" value="Save" class="form-submit">

This works all other elements that are not input's, but is there a way to get it to work on the above code?

Thank you

Community
  • 1
  • 1
Shane Grant
  • 2,484
  • 4
  • 26
  • 32
  • http://stackoverflow.com/questions/2587669/css-after-pseudo-element-on-input-field here is the answer – simoncereska Sep 12 '11 at 05:51
  • @simoncereska I had seen that page. but the accepted answer does not seem to work, and the second answer seems to say it is not possible. Is there no way to do this with js? – Shane Grant Sep 12 '11 at 06:01
  • I suggest to add some wrapper and set styles for it. Maybe there is some workaround with js, but I guess it would add some elements before/ after or even the same wrapper :) ( just my thoughts ) – simoncereska Sep 12 '11 at 06:07
  • Not every accepted answer works for everyone, unfortunately. – BoltClock Sep 12 '11 at 06:30

1 Answers1

2

No CSS, but Javascript:

var inputs = document.getElementsByTagName('input');
for (var i = 0, il = inputs.length; i < il; i++) {
  if (inputs[i].type.toLowerCase() == 'submit') {
    inputs[i].value = '\u2714 ' + inputs[i].value;
  }
}

See demo

mVChr
  • 49,587
  • 11
  • 107
  • 104