Tartalomjegyzék

< jQuery

jQuery - Űrlap sorosítása

Űrlap

    <form id="signupForm" action="signupsub.html">
 
        <label for="user">Felhasználónév</label>
        <input type="text" id="user" name="user">
 
        <br>
 
        <label for="email">E-mail</label>
        <input type="email" id="email" name="email">
        <br>
 
 
        <label for="pass">Jelszó</label>
        <input type="password" id="pass" name="pass">
        <br>
 
        <label for="confirm_pass">Jelszó újra</label>
        <input type="password" id="confirm_pass" name="confirm_pass">
        <br>
 
        <button>Regisztrál</button>
    </form>

A form elem azonsítója

$('#signupForm').on('submit', event =>{
    let data = $('#signupForm').serializeArray();
    console.table(data);
    event.preventDefault();
});

Űrlap fieldset elemmel

    <form id="signupForm" action="signupsub.html">
        <fieldset id="basedata">
 
        <label for="user">Felhasználónév</label>
        <input type="text" id="user" name="user">
 
        <br>
 
        <label for="email">E-mail</label>
        <input type="email" id="email" name="email">
        <br>
 
 
        <label for="pass">Jelszó</label>
        <input type="password" id="pass" name="pass">
        <br>
 
        <label for="confirm_pass">Jelszó újra</label>
        <input type="password" id="confirm_pass" name="confirm_pass">
        <br>
        </fieldset>
 
        <button>Regisztrál</button>
    </form>

jQuery

$('#signupForm').on('submit', event =>{
    let data = $('#basedata').serializeArray();
    console.log('megy');
    console.table(data);
    event.preventDefault();
});