Get the selected value
Get the value of a group of radio selected items
var item = $('input[@name=items][@checked]').val();
Get the text of the selected item
var item = $("select[@name=items] option[ @selected]").text();
The second element of the select drop-down box is the currently selected value
$('#select_id')[0].selectedIndex = 1;
The second of the radio radio selection group elements are the currently selected values
$('input[@ name=items]').get(1).checked = true;
Get value:
Text box, text area:
$("#txt").attr("value");
$("#txt").val();
Multiple selection box checkbox:
$("#checkbox_id").attr("value");
Radio selection group radio:
$("input[@type=radio][@checked]") .val();
Drop-down box select:
$('#sel').val();
Control form elements:
Text box, text area:
$("#txt").attr("value",'');//Clear the content
$("#txt").attr("value",'11');//Fill content
Multiple selection box checkbox:
$("#chk1").attr("checked",'');//Do not type Check
$("#chk2").attr("checked",true);//Tick
if($("#chk1").attr('checked')==undefined) // Determine whether it has been checked
Radio group radio:
$("input[@type=radio]").attr("checked",'2');//Set the item with value=2 as the currently selected item
Drop-down box select:
$("#sel" ).attr("value",'-sel3');//Set the item with value=-sel3 as the currently selected item
$("1111 2222").appendTo("#sel")//Add the option of the drop-down box
$("#sel").empty();//Clear the drop-down box
=======================
In Jquery, use $("#id") to get the input element of the page, which is equivalent to document.getElementById("element"). However, what you get is a Jquery object, not a dom element object. Value is an attribute of the dom element object. Therefore, the value cannot be obtained using $("#id").value. The method of obtaining the value is as follows: Value: val = $("#id")[0].value; $( "#id")[0].value = "new value"; Assignment: $("#id")[0].value = "new value";
or $("#id").val( "new value"); val = $("#id").attr("value");
==================================
jquery input text radio check select