How to target all input text and password value?

前端 未结 2 476
悲哀的现实
悲哀的现实 2021-01-25 18:33

I\'m trying to figure out how to target every input(text and password) field on all forms on the page document to remove the default value when on focus with this single script:

2条回答
  •  佛祖请我去吃肉
    2021-01-25 19:04

    Get all the input type text value:

    $("input:text").each(function() {
      alert($(this).val());
    });
    

    Get all input type password value:

    $("input:password").each(function() {
      alert($(this).val());
    });
    

提交回复
热议问题