Hi, I want to validate my form fields but jquery does not select them
if they are inside a div (using UI Tabs).

function checkRequiredFields(form, error_msg)
{
        var resultado = false;

        $(document).ready(function(){

                $("#"+form+" > :input[id$='_required']").each(function(){

                        if( $(this).val() == '' )
                        {
                                alert(error_msg);

                                $(this).focus();

                                resultado = false;
                        }

                });
        });

        return resultado;
}

A typical form can look like this

<form id="form_id" method="post" action="url">
<input type="text" id="field_1" />
<div>
     <input type="text" id="field_2" />
</div>
</form>

In this case, jQuery does not select field_2. Is this a jQuery bug?
Does it have a solution?

Thanks.

Reply via email to