0

I have a jQuery select option where I have to kind of freeze (disable) from any changes. But when I do

 $(this).attr('disable', true);

the select freezes but the value it sends in null as there is no more anything selected in it. How can I freeze and still send the selected values?

user
  • 3,000
  • 22
  • 45
Nihal Sharma
  • 2,227
  • 7
  • 36
  • 57

2 Answers2

0

You cannot pass the disabled input fields to post. Use readonly or hidden fields or make this select style to display:none.

Best will be use readonly

Kailash Yadav
  • 1,780
  • 2
  • 17
  • 37
0

You could enable the element again before submit.

$('#myForm').submit(function() {

  $(this).find(':input:disabled') // Find disabled form elements within the form
    .prop('disabled', false); // Enable elements

});
Stefan
  • 5,564
  • 4
  • 22
  • 30