如何更改 jquery 提示文本颜色。目前它与文本字段的颜色相同,但我希望它不同!
$(document).ready(function () {
//Shows the title in the text box, and removes it when modifying it
$('input[title]').each(function (i) {
$(this).val($(this).attr('title')).addClass('hint');
$(this).focus(function () {
if ($(this).val() == $(this).attr('title')) {
$(this).val('').removeClass('hint');
}
});
$(this).blur(function () {
if ($(this).val() == '') {
$(this).val($(this).attr('title')).addClass('hint');
}
});
});
//Clear input hints on form submit
$('form').submit(function () {
$('input.hint').val('');
return true;
});
});
你在 css 中更改它的方式与上一个线程相同 我刚刚给了你 jQuery 代码替换你的提示 10 分钟前
http://jsfiddle.net/jzCeq/2/