Hi,

I want to select all the values from the filled in/checked/selected
fields in a form and concatenate them in a string so I can pass it on
to the history plugin.

I have written working code, but I feel that it could be simplified.
Any suggestions?

    var args = '';
    $('.advancedSearchForm :input').each(
        function(){
            switch($(this).attr('type')){
                case("text"):
                case("select-one"):
                    if($(this).val() != '' && $(this).attr("hidden" !=
"true")){
                        args += $(this).attr("name") + "=" + $
(this).val()+";";
                    };
                    break;
                case("radio"):
                    if($(this).attr('checked') && $(this).val() != '')
{
                        args += $(this).attr("name") + "=" + $
(this).val()+";";
                    };
                    break;
            }
        }
    );
    return args;

Reply via email to