I have set select disabled by jQuery, but while I submit the form data, it does not get the value of select input. How can I get a select input value while it is disabled in PHP?
My JS Code:
var custid = $('#oppid').find(':selected').data('custid'); // I have get the value from anothe $('#customerid option[value='+custid+']').attr('selected','selected'); $("#customerid").prop("disabled", true);
if select disabled not pass value properly apply this code:
$('#customerid option:not(:selected)').each(function(){ $(this).attr('disabled', 'disabled'); });
For example:
var custid = $('#oppid').find(':selected').data('custid'); $('#customerid option[value='+custid+']').attr('selected','selected'); $('#customerid option:not(:selected)').each(function(){ $(this).attr('disabled', 'disabled'); });
Hope it will be helpful for you.
Question and answer is powered by AnsPress.io