After developing some scripts to automatically populate the data-length and data-width in textboxes based on a dropdown selection, I now face the challenge of making the .width and .length textboxes readonly depending on the selected dropdown option.
Is there a way to modify the code below to achieve this functionality?
$(document).ready(function() {
$('select.cargo_type').change(function() {
var eur1width = $('select.cargo_type').find(':selected').data('width');
$('.width').val(eur1width);
//make width textbox readonly
var eur1length = $('select.cargo_type').find(':selected').data('length');
$('.length').val(eur1length);
//make length textbox readonly
});
});