Cara Supaya Text Bisa Diklik Di Radio Button

Ketika kita membuat radio button di web, default-nya text di sebelah radio button itu tidak bisa diklik, tidak sinkron dengan radio button-nya.

Contoh penggunaannya adalah aplikasi kuis. Cara supaya text itu berkoresponden terhadap radio button yang kita buat, gunakan skrip berikut ini:

<form>
    <p>What is my middle name?</p>
    <br>
    <input id="349" type="radio" value="1" name="question1">
    <label for="349">Abe</label>
    <br>
    <input id="350" type="radio" value="2" name="question1">
    <label for="350">Andrew</label>
    <br>
    <input id="351" type="radio" value="3" name="question1">
    <label for="351">Andre</label>
    <br>
    <input id="352" type="radio" value="4" name="question1">
    <label for="352">Anderson</label>
    <br>
</form>

sedangkan demo-nya bisa dilihat di sini.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s