开发者

CSS: How can I add something before the value of an input? [duplicate]

开发者 https://www.devze.com 2023-04-03 23:44 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: CSS :after pseudo element on INPUT field
This question already has answers here: Closed 11 years ago.

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 a开发者_运维知识库m 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消