IE 不支持输入元素的占位符。我正在尝试使用 jquery 解决方法
我想要的是在页面加载字段值 sld 得到初始化。我能够专注于现场。例如。这行得通
// ThiS Works on focus, "Email" is shown in text box
$(function() {
$("#login_email").focus(function()
{
if ($(this).val() == "")
{
$(this).val("Email");
}
});
});
// I hoped that this will intialize on page load. But this does not work ???
// This does not work
$(function() {
$("#login_email").val("Email");
});
我怎样才能解决这个问题?
为什么选项 2 不起作用但选项 1 起作用?有什么区别??