Pregunta

I have this function

function val_form (e) {
    event.preventDefault();
    e = e || window.event;
    e = e.target || e.srcElement;
    var myID = e.id;
    //alert(myID);
    $.post($('#'+myID).attr('action'), $('#'+myID).serialize(), function( data ) {
        if(data.st == 0 || !data.st)
        {
            $('#'+myID).childern('.vlad_error').html(data.msg);
        }

        if(data.st == 1)
        {
            $('#'+myID).childern('.vlad_error').html(data.msg);
        }
        //alert(data.msg);

    }, 'json');
    return false;   
}

I want to select the child .vlad_error of this form only , not all the page. How can this be done please?

¿Fue útil?

Solución

You can use selector which means child of what is left to that space.

Like this:

$('form .vlad_erro');
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top