Home > Article > Web Front-end > jQuery's method of obtaining and assigning values to html elements_jquery
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:
//Text box, text area:
$("#text_id").attr("value",'');//Clear the content
$("#text_id").attr(" value",'test');//Fill content
LABLE:
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