$("input[flag][value!='']").addClass('red');  自己试出来了.

解决方案 »

  1.   

    $(function(){
                $("#aaa").click(function(){
                    $("input[type='text']").each(function(){
                        if($(this).val() != ''){
                            alert($(this).val());
                        }
                    })            });        })
      

  2.   

    $(document).ready(function(e) {
    $("#eachBtn").click(function(){
    $("input[type='text']").each(function() {
                if($(this).val()!= false){
    alert($(this).attr("flag"));
    }
            });
    });
    });
      

  3.   


    这种是在获取所有的INPUT后再去做判断,实际情况是一个页面有上百个INPUT,只需要摘取出有填数据的INPUT拼个JSON出来就行了.还是谢谢你的回复了.