Jquery takes and assigns values to basic controls TEXTBOX: var str = $('#txt').val(); $('#txt').val("Set Lbl Value"); //Text box , text area: $("#text_id").attr("value",'');//Clear content $("#text_id").attr("value",'test');//Fill content
TEXTBOX:
var str = $('# txt').val();
$('#txt').val("Set Lbl Value");
//Text box, text area: $("#text_id").attr("value",'');//Clear the content $("#text_id").attr(" value",'test');//Fill content
LABLE:
var str = $('# lbl').text();
$('#lbl').text("Set Lbl Value");
var valradio = $("input[@type=radio][@checked]").val(); var item = $('input[@name=items][@checked]'). val(); var checkboxval = $("#checkbox_id").attr("value"); var selectval = $('#select_id').val(); //Multiple selection Box checkbox: $("#chk_id").attr("checked",'');//Make it unchecked $("#chk_id").attr("checked",true) ;//Check if($("#chk_id").attr('checked')==true) //Judge whether
radio group radio:
$("input[@type=radio]").attr ("checked",'2'); //Set the item with value=2 as the currently selected item //Drop-down box select: $("#select_id").attr("value" ,'test');//Set the item with value=test as the currently selected item $("test test2< ;/option>").appendTo("#select_id")//Add the option of the drop-down box $("#select_id").empty();//Clear the drop-down box Get a group The value of the selected radio item named (items) var item = $('input[@name=items][@checked]').val();//If it is not selected, val() = undefined Get the text of the selected item in select var item = $("select[@name=items] option[@selected]").text(); select the second element of the drop-down box is the currently selected value $('#select_id')[0].selectedIndex = 1; The second element of the radio radio selection group is the currently selected value $('input[@name=items ]').get(1).checked = true; //Reset form $("form").each(function(){ .reset(); });