latest Post

Jquery codes for Get and Set values to the HTML controls

Get label value:
$('#Label1').text();

Set label value:
$('#Label1').text("New Value");

Get Textbox value:
$('#TextBox1').val();

Set Textbox value:
$('#TextBox1').val("New Value");

Get Dropdown value:
$('#DropDownList1').val();

Set Dropdown value:
$('#DropDownList1').val("New Value");

Get text of selected item in dropdown:
$('#DropDownList1 option:selected').text();

Get Checkbox Status:
$('#CheckBox1').attr('checked');

Check the Checkbox:
$('#CheckBox1').attr('checked',true);

Uncheck the Checkbox:
$('#CheckBox1').attr('checked',false);

Get Radiobutton Status:
$('#RadioButton1').attr('checked');

Check the RadioButton:
$('#RadioButton1').attr('checked',true);

Uncheck the RadioButton:
$('#RadioButton1').attr('checked',false);

Disable any control:
$('#TextBox1').attr('disabled', true);

Enable any control:
$('#TextBox1').attr('disabled', false);

Make textbox read only:
$('#TextBox1').attr('readonly', 'readonly');

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment