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,058
  • 23
  • 45
Nihal Sharma
  • 2,397
  • 11
  • 41
  • 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,880
  • 2
  • 18
  • 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,644
  • 4
  • 24
  • 31