Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get the value of state of on and off

//FOR CHECK BOX / SWITCH
var stateValue = $("#yourInputElement").is(":checked");
// will be set to the element value if checked (ON) or will be null otherwise
var stateValue = $("#yourInputElement").is(":checked") ? $("#yourInputElement").val() : null;

//FOR RADIO
var stateValue = $(":radio:checked", radioParentContainer).val();
Source by github.com #
 
PREVIOUS NEXT
Tagged: #state
ADD COMMENT
Topic
Name
8+5 =