[jQuery] Loop over all input elements in form

[jQuery] Loop over all input elements in form


Hi All,
I tried
$("form").each(function() {
     alert(this.name);
alert($("input").val());
});
in following HTML
    <form id="form" name="form1">
        Form 1
        <input name="foo" value="XXX" />
    </form>
    <form id="form" name="form2">
        Form 2
        <input name="blr" value="YYY" />
    </form>
    <form id="form" name="form3">
        Form 3
        <input type="checkbox" />
        <input type="checkbox" checked="checked" />
    </form>
it only alert "XXX" nothing else !!! any idea about this. My journey
till now is difficult in jquery :-( .Hope to see some answers tomorrow.