0

ギデー

jquery UIを学習しただけで、今日は非常に良い進歩を遂げましたが、フォームを送信する前に、ボタンセットで選択したボタンのIDを取得する方法を理解するのに困惑しています。

選択したボタンのIDを取得したら、AJAXPOSTを機能させる方法を知っています。

最初の部分はどのように行われますか?

これが私のjqueryです:

$( "#pi" ).buttonset();


    $( "#req1" ).dialog({           

        resizable: false,
        height:350,
        minWidth: 310,
        modal: true,
        buttons: {
            "Send request": function() {


                     //what goes here to retrieve the ID of the selected button?


                $( this ).dialog( "close" );
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        }
    });

そして私の形...

<div id="req1" title="make your selection:">

<form>
<div id="pi">
    <input type="radio" id="p1" name="pi" /><label for="p1">3</label>
    <input type="radio" id="p2" name="pi" /><label for="p2">2</label>
    <input type="radio" id="p3" name="pi" /><label for="p3">1</label>
    <input type="radio" id="p4" name="pi" checked="checked" /><label for="p4">0</label>
    <input type="radio" id="p5" name="pi" /><label for="p5">1</label>
    <input type="radio" id="p6" name="pi" /><label for="p6">2</label>
    <input type="radio" id="p7" name="pi" /><label for="p7">3</label>
</div>

お手数をおかけしますが、よろしくお願いいたします。

4

1 に答える 1

0

これを試して:

var id = $('#pi input[name=pi]:checked').attr('id');
于 2012-09-30T06:24:23.357 に答える