Reputation: 499
I have created 20 radio button dynamically
<script>
$(function() {
$( "#sortable1, #sortable2" ).sortable({
connectWith: ".connectedSortable"
}).disableSelection();
$( "#sortable2" ).sortable({
remove: function(event, ui) {
t = ui.item[0].attributes['id'].nodeValue;
k = $("input[name='"+t+"' ]");
k.remove();
},
receive: function(event, ui) {
//itemid = ui.item[0].attributes['id'];
t = ui.item[0].attributes['id'].nodeValue;
$("#element").append( "<br/>" +ui.item[0].innerHTML.trim() );
for(i=1; i<=20; i++)
{
j=$("#over" + i).append("<br/> <td><input type=radio name='"+ui.item[0].innerHTML.trim()+"' value='"+i+"'></td> <br/>");
var radVal=$("#over" + i+":checked").val();
alert(radVal);
}
}
});
});
` 'Player';
for($j=1;$j<=20;$j++)
{
echo '<th align="center">'.$j.'</th>';
}
echo '';
echo ""; { echo ""; echo ""; echo "";
for($i = 1; $i <=20; $i++)
{
echo "";
echo "";
echo "";
}
}
echo "";
?> `
my question is that how to check validation value
Upvotes: 0
Views: 1992
Reputation: 9915
Change the code where you generate the radiobutton to: (Add the value attribute)
<input type=radio name='"+ui.item[0].innerHTML.trim()+"' value='"+i+"'>
After adding all the radio button if you call this function on any click event
function getChecked(){
var radVal=$("input[name=nameOfRadiobuttons]:checked").val();
alert(radVal);
}
Put a button on th HTML Page calling the function
<input type=button onclick='getChecked()'>
radVal will give the index of the checkbox selected..If its undefined then you might not have checked any radio button
Upvotes: 1
Reputation: 61
var temp = $('#over1:checked').val();
or
var temp = $('#over1').val();
Upvotes: 1