jonathansp/jquery-serializeFields

Problem when get value from radio input

Closed this issue · 0 comments

It get the last value from a Radio input.

Look this test case:

QUnit.test("When form has radio button input it should get value from checked", function(assert) {

    // given
    var form = '<form>'+
    +'<input type="radio" name="sex" value="male" checked>Male'
    +'<input type="radio" name="sex" value="female">Female'
    +'</form>';

    // when
    var result = $(form).serializeFields()

    // then
    assert.equal(result.sex, "male", "Property sex has value male!")
});