-3

プレースホルダー効果を得るために、html 5 で提供されるプレースホルダー属性を使用しています。

<input id="search" class="hasPlaceholder" type="text" placeholder="Personal Trainer" 
value="" name="search">

また、送信時に placeolder をクリアするコードを追加しました。

$(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("");
            } 
            });
        });
    }
});

ただし、送信後にプレースホルダー値が提供されます。

4

1 に答える 1

1

あなたの質問の最後の部分(すべての職業/産業のリストをExcel形式で入手できる場所を提案してください)をGoogleに入力したとき、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

例のデータ。

于 2012-08-21T09:15:45.910 に答える