JQuery: zeigen Sie div auf radiobutton auswählen

Ich versuche jQuery zu zeigen, ein div, wenn der Benutzer wählt einen bestimmten radio-button (Other) in einer radiobutton-Gruppe.

Der html-Code wird unterhalb

<div id="countries">

<input id="Washington_D.C" type="radio" name="location" value="Washington">Washington D.C</input>
<input id="Other" type="radio" name="location" value="">Other</input>
    <div id="other locations" style="display: none">
    </div>
</div>

Mithilfe der JQuery-code:

$(document).ready(function(){
    $("radio[@name='location']").change(function(){
        if ($("radio[@name='location']:checked").val() == 'Other')
        $("#county_drop_down").show();
    });
 });

Aber es ist nicht die die div anderen stellen, wenn ich wählen Sie die radiobutton -Other.

InformationsquelleAutor van | 2010-04-14

Schreibe einen Kommentar