javascript - How to control checkbox value on client side with mvc -


i have problem. how control checkbox value on client side mvc, possible ? used checkbox's value getting bool variable. other guy changed different value example,

original;

<input data-val="true" data-val-required="required place" id="confirm" name="confirm" required="required" type="checkbox" value="true"> 

trytohack;

<input data-val="differentvalue" data-val-required="required place" id="confirm" name="confirm" required="required" type="checkbox" value="differentvalue"> 

such when throw exception, how block state mvc ?

you can jquery. value attribute shouldn't bool, can text.

$('#confirm').val(); //returns value of checkbox $('#confirm').val("test"); //sets value "test" $('#confirm').is(':checked'); //returns if checkbox checked (true or false) 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -