Skip to main content
etiquetas editadas
Enlace
JackNavaRow
  • 7.2k
  • 6
  • 25
  • 49
Título sin mayúscula sostenida, formato de pregunta
Origen Enlace

COMO PUEDO LIMPIAR FORMULARIO CON JAVASCRIPT Cómo puedo limpiar un formulario con JavaScript?

Este es mi código actual

$('#contactform').submit(function(e) {
        e.preventDefault();
        var contact_name = $("#name").val();
        var contact_email = $("#email").val();
        var subject = $("#subject").val();
        var your_phone = $("#phone").val();
        var your_message = $("#message").val();
        $.post("sendmail.php", {
            name: contact_name,
            email: contact_email,
            phone: your_phone,
            subject: subject,
            message: your_message,
        }, function(data, status) {
           

            document.getElementById('msgmail').innerHTML = data

        })

    });

COMO PUEDO LIMPIAR FORMULARIO CON JAVASCRIPT

$('#contactform').submit(function(e) {
        e.preventDefault();
        var contact_name = $("#name").val();
        var contact_email = $("#email").val();
        var subject = $("#subject").val();
        var your_phone = $("#phone").val();
        var your_message = $("#message").val();
        $.post("sendmail.php", {
            name: contact_name,
            email: contact_email,
            phone: your_phone,
            subject: subject,
            message: your_message,
        }, function(data, status) {
           

            document.getElementById('msgmail').innerHTML = data

        })

    });

Cómo puedo limpiar un formulario con JavaScript?

Este es mi código actual

$('#contactform').submit(function(e) {
        e.preventDefault();
        var contact_name = $("#name").val();
        var contact_email = $("#email").val();
        var subject = $("#subject").val();
        var your_phone = $("#phone").val();
        var your_message = $("#message").val();
        $.post("sendmail.php", {
            name: contact_name,
            email: contact_email,
            phone: your_phone,
            subject: subject,
            message: your_message,
        }, function(data, status) {
           

            document.getElementById('msgmail').innerHTML = data

        })

    });

$('#contactform').submit(function(e) { e.preventDefault(); var contact_name = $("#name").val(); var contact_email = $("#email").val(); var subject = $("#subject").val(); var your_phone = $("#phone").val(); var your_message = $("#message").val(); $.post("sendmail.php", { name: contact_name, email: contact_email, phone: your_phone, subject: subject, message: your_message, }, function(data, status) {

$('#contactform').submit(function(e) {
        e.preventDefault();
        var contact_name = $("#name").val();
        var contact_email = $("#email").val();
        var subject = $("#subject").val();
        var your_phone = $("#phone").val();
        var your_message = $("#message").val();
        $.post("sendmail.php", {
            name: contact_name,
            email: contact_email,
            phone: your_phone,
            subject: subject,
            message: your_message,
        }, function(data, status) {
           

            document.getElementById('msgmail').innerHTML = data

        })

    });

$('#contactform').submit(function(e) { e.preventDefault(); var contact_name = $("#name").val(); var contact_email = $("#email").val(); var subject = $("#subject").val(); var your_phone = $("#phone").val(); var your_message = $("#message").val(); $.post("sendmail.php", { name: contact_name, email: contact_email, phone: your_phone, subject: subject, message: your_message, }, function(data, status) {

        document.getElementById('msgmail').innerHTML = data

    })

});
$('#contactform').submit(function(e) {
        e.preventDefault();
        var contact_name = $("#name").val();
        var contact_email = $("#email").val();
        var subject = $("#subject").val();
        var your_phone = $("#phone").val();
        var your_message = $("#message").val();
        $.post("sendmail.php", {
            name: contact_name,
            email: contact_email,
            phone: your_phone,
            subject: subject,
            message: your_message,
        }, function(data, status) {
           

            document.getElementById('msgmail').innerHTML = data

        })

    });
Origen Enlace
Loading