I have a lot of templates with some text input like this:
The client asked me to hide the placeholder value (Keywords in the example) when the user click on the field. I don't know how to do this with JS and JQuery. Is there a way to make this happen with a crossbrowser solution?
解决方案
Try this: { check it if cross browser }
$('input[placeholder]').on('focus', function () {
var $this = $(this);
$this.data('placeholder', $this.prop('placeholder')).removeAttr('placeholder')
}).on('blur', function () {
var $this = $(this);
$this.prop('placeholder', $this.data('placeholder'));
});