input:
var xxx = $('#ID').val()
-------------------------------------------------- ----------------------------------
checkbox:
var xxx = [ ]; $('input[name=MyName]:checked).each(function(index, element) { xxx.push($(element).val()); // 或者 xxx.push($(this).val()); });
Note: This is not based on ID, which is a bit loose. If your checkbox element is a child element of a container (assuming the container's id is con_id), you can choose like this:
======
$('#con_id input[name=MyName]:checked') 或者 $('input[name=MyName]:checked', '#con_id')
-------------------------------------------------- ----------------------------------
radio:
var xxx = $(''input[name=MyName]:checked”).val();
======
Note: Nothing based on ID here. To limit the specified ID, see the checkbox above
-------------------------------------------------- ----------------------------------
select:
var xxx = $("#ID option:selected").val();
======
Note two points:
1. The selected attribute of select is "seleted", not "checked".
2. Select is "single selection" by default. If it is multiple selection, I have not tried it. Presumably it can be handled with .each().