$(function () {

    if (!placeholderSupport()) {

        $('[placeholder]').focus(function () {

            var input = $(this);
            if (input.val() == input.attr('placeholder')) {
                input.val('');
                input.removeClass('placeholder');
            }

        }).blur(function () {
            var input = $(this);
            if (input.val() == '' || input.val() == input.attr('placeholder')) {
                input.addClass('placeholderSupport');
                input.val(input.attr('placeholder'));
            }
        }).blur();
    }
});
function placeholderSupport() {
    return 'placeholder' in document.createElement('input');
}

相关文章:

  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
  • 2022-01-02
  • 2021-11-04
猜你喜欢
  • 2022-03-04
  • 2021-08-14
  • 2021-10-06
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案