0

どのラジオ ボタンが選択されているかによって図形を描画するために raphael.js を使用していますが、一度に表示する図形は 1 つだけです。ラジオ ボタンをクリックすると一度にすべての図形が表示され、別のラジオ ボタンをクリックすると図形が再描画されます。本当に助けていただければ幸いです。

HTML:

    <input name="shapes" id="square" type="radio">
    <label for="square">Square</label>
    <input name="shapes" id="rectangle" type="radio">
    <label for="rectangle">Rectangle</label>
    <input name="shapes" id="circle" type="radio">
    <label for="circle">Circle</label>

ラファエル/jquery

    $(':radio[name="shapes"]').on('click', function(){
       var shapeName = $(this).attr('id');

       var square = p.rect(10,10,40,40);
       var rectangle = p.rect(20,20,50,80);
       var circle = p.circle(40,40,10);

       console.log(shapeName);
       return shapeName;

    });
4

1 に答える 1