Hide placeholder value with JQuery

前端 未结 1 1641
南旧
南旧 2021-01-24 13:10

I have a lot of templates with some text input like this:



        
相关标签:
1条回答
  • 2021-01-24 13:56

    Try this: { check it if cross browser }

    http://jsfiddle.net/MDhtj/1

    $('input[placeholder]').on('focus', function () {
        var $this = $(this);
        $this.data('placeholder', $this.prop('placeholder')).removeAttr('placeholder')
    }).on('blur', function () {
        var $this = $(this);
        $this.prop('placeholder', $this.data('placeholder'));
    });
    
    0 讨论(0)
提交回复
热议问题