if jquery has no 'readonly' on 'select' and 'checkbox'? -


i can't find function readonly on 'select' , 'checkbox'. 'disable 'seems option variable no longer exist. fix them out by:

$('input[type=checkbox]').each(function(){         if ( $( ).prop( "checked" ) ){             $(this).change(function() {                 $(this).prop('checked', true);             });          } else{             $(this).prop("disabled", true);         }      });  $('select option:not(:selected)').prop("disabled", true); 

they seems ok , may leave 1 choice want , others disabled.

are there other options?

there disabled checkboxes , selects. because readonly prevents user changing value of input , not interacting , changing state of input.

with checkboxes , select input change state instead of value , readonly has no effect.

so should use disable instead. still submit values can use hidden field contains value want submit , display disabled checkbox user let him know there.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -