Wie man überprüft, radio buttons Wert in jQuery mobile?

Habe ich eine Reihe von radio-button-Gruppen. Wie bekomme ich die aktiviert ist ja jetzt für jede group und fügen Sie Sie zum array?

Hier ist, was ich kam so weit:

Mein jquery-code:

<script type="text/javascript">
    $(function () {

        $("#getinfo").click(function () {

            $("input[name*=radio-choice-1]:checked").each(function () {
                 alert($(this).val());
            });

        });   

    });       

</script>

- und radio-buttons

<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">        
<input type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" />
<label for="radio-choice-1">Yes</label>
<input type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2" />
<label for="radio-choice-2">No</label>
</fieldset>

<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">        
<input type="radio" name="radio-choice-3" id="radio-choice-3" value="choice-3" />
<label for="radio-choice-3">Yes</label>
<input type="radio" name="radio-choice-3" id="radio-choice-4" value="choice-4" />
<label for="radio-choice-4">No</label>
</fieldset>

<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">        
<input type="radio" name="radio-choice-5" id="radio-choice-5" value="choice-5"  />
<label for="radio-choice-5">Yes</label>
<input type="radio" name="radio-choice-5" id="radio-choice-6" value="choice-6" />
<label for="radio-choice-6">No</label>
</fieldset>

<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">        
<input type="radio" name="radio-choice-7" id="radio-choice-7" value="choice-7" />
<label for="radio-choice-7">Yes</label>
<input type="radio" name="radio-choice-7" id="radio-choice-8" value="choice-8" />
<label for="radio-choice-8">No</label>
</fieldset>

<a href="#" id="getinfo">getinfo</a>
Ist Ihr Alarm nicht funktioniert? Oder sind Sie einfach nur verwirrt darüber, wie, um Sie in ein array?
Tut mir Leid, ich war nicht klar genug. Mein Alarm funktioniert nicht

InformationsquelleAutor Steven | 2012-02-24

Schreibe einen Kommentar