The default value is 'on'. You need to assign a value to each radio;
also the selector you're using selects all of the radios without
distinguishing between selected or not.

Try this to experiment with:

$(':radio.star').click(function(){
        console.log($(this).val());
});

Your html should look like:

 <input type="radio" name="concept" class="star" value="1" />
 <input type="radio" name="concept" class="star" value="2" />
 <input type="radio" name="concept" class="star" value="3" />
 <input type="radio" name="concept" class="star" value="4" />
etc.

On Jun 20, 10:16 am, W0utR <woutr...@gmail.com> wrote:
> Hi, i'm using php to create the stars for rating:
> echo '<p>';
>    echo "<strong>Concept</strong>";
>    for($i = 1; $i < 6; $i ++) {
>    ?>
>        <input type="radio" name="concept" class="star" />
>    <?php
>    }
> echo '</p>';
>
> But how can i know what rating is selected?
>
> When i use:
> console.log($('input[name=concept]').val());
>
> i just get: "on"

Reply via email to