Search code examples
javascriptjqueryselectreadonly

how to set select element as readonly ('disabled' doesnt pass select value on server)


When i used any of the following code ,select element do looks like disabled,but the select is not pass on the server : Im thinking of the readonly to be used, but i dont know or is that will solved the issue. Any help is much appreciated.

$('#selectID').prop('disabled',true);

$('#selectID').prop('disabled','disabled');

$('#selectID').attr('disabled',true);

$('#selectID').attr('disabled','disabled');

Solution

  • To be able to pass the select, I just set it back to :

      $('#selectID').prop('disabled',false);
    

    or

      $('#selectID').attr('disabled',false);
    

    when passing the request.