Multiple forms

Multiple forms

how todo a mutliple form with this function:

  1. $(function() {
    $('.error').hide();
    $(".button").click(function() {
    $('.error').hide();

    var name = $("input#name").val();
    if (name == "") {
    $("label#name_error").show();
    $("input#name").focus();
    return false;
    }
    var dataString = 'name='+ name;

    $.ajax({
    type: "POST",
    url: "/mailer.php",
    data: dataString,
    success: function() {
    $('#contact_form').html("<div id='message'></div>");
    $('#message').html("<h2>Contact Form Submitted!</h2>")
    .append("<p>We will be in touch soon.</p>")
    .hide()
    .fadeIn(1500, function() {
    $('#message').append("<img id='checkmark' src='images/check.png' />");
    });
    }
    });
    return false;
    });
    });































and





  1. <div id="contact_form1">
    <form name="contact" method="post" action="">
    <label for="name" id="name_label">Name</label>
    <input type="text" name="name" id="name" size="30" class="text-input" />
    <label class="error" for="name" id="name_error">missing!</label>
    <input type="submit" name="submit" class="button" id="submit_btn" value="Send" />
    </form>
    </div>