开发者

JQUERY buttonset radio multiple on one page

Hey all I'm trying to get multiple radio buttons to work on one page. This is the idea I have.

I have several selections

        Days 1 2 3 4 5
Item         x
Item 2         x
Item 3               x

I would like to recite this idea with jquery. I have the basic layout in html and i have the appriate radio buttons in place ready for selection, workds a charm, but adding the jquery buttonset doesn't work for me as a class, as an ID obviously it will change each item.

THE JAVASCRIPT

$( ".radio-days" ).buttonset();

THE PEE HAYCH PEE

<?php 
    for($j = 0; $j < 5; $j++)
    {
?>

    <form>
        <开发者_如何学Cdiv id='item<?php echo $j; ?>' class='radio-days'>
        <?php 
            for($i = 0; $i < 8; $i++)
            {
            ?>
            <input type="radio" id="radio<?php echo $i; ?>" name="radio<?php echo $i; ?>" /><label for="radio<?php echo $i; ?>"><?php echo $i; ?></label>
            <?php
            }
        ?>
        </div>
    </form>

<?php
    }
?>

in absolute dire need of help here :(


You cannot assign an id with multiple elements in html. Try

<?php 
    for($j = 0; $j < 5; $j++)
    {
?>

    <form>
        <div id='item<?php echo $j; ?>' class='radio-days'>
        <?php 
            for($i = 0; $i < 8; $i++)
            {
            ?>
            <input type="radio" id="radio<?php echo $j; ?>_<?php echo $i; ?>" name="radio<?php echo $j; ?>" /><label for="radio<?php echo $j; ?>_<?php echo $i; ?>"><?php echo $i; ?></label>
            <?php
            }
        ?>
        </div>
    </form>

<?php
    }
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜