我使用html 5中提供的占位符属性来获得占位符效果。
<input id="search" class="hasPlaceholder" type="text" placeholder="Personal Trainer"
value="" name="search">
此外,我还添加了代码以在提交时清除占位符。
$(function() {
if(!$.support.placeholder) {
var active = document.activeElement;
$(':text').focus(function () {
if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
$(this).val('').removeClass('hasPlaceholder');
}
}).blur(function () {
if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
$(this).val($(this).attr('placeholder'));
$(this).addClass('hasPlaceholder');
}
});
$(':text').blur();
$(active).focus();
$('form').submit(function () {
$(this).find('.hasPlaceholder').each(function() {
var input = $(this);
input.removeClass('hasPlaceholder');
if (input.val() == input.attr('placeholder')) {
input.removeAttr('placeholder');
input.val("");
}
});
});
}
});
但它仍然在提交后提供占位符值。
当我在谷歌上输入你问题的最后一部分(请建议我在哪里可以获得excel格式的所有职业/行业列表)时,我在第1页上看到了这个链接。它有一个指向这个电子表格的链接,其中包含您正在查找的确切内容。我喜欢帮助别人,但说真的,先做一些调查和谷歌搜索。
11-0000 Management Occupations
11-1000 Top Executives
11-1010 Chief Executives
11-1011 Chief Executives
11-1020 General and Operations Managers
11-1021 General and Operations Managers
11-1030 Legislators
11-1031 Legislators
示例数据。