I am setting and disabling the textbox using jquery. When I click on save and posted to server, I can't see this particular element value.
$('#FirstName').prop('disabled', true);
How can I disable the textbox and post the value to server?
I am setting and disabling the textbox using jquery. When I click on save and posted to server, I can't see this particular element value.
$('#FirstName').prop('disabled', true);
How can I disable the textbox and post the value to server?
By design disabled form controls are not included in the submitted data. If your aim is to prevent users from changing the set value use readonly
instead:
$('#FirstName').prop('readOnly', true);
To make all form fields within a given div
, use the following:
$('div :input').prop( 'readOnly', true );
You could possibly use something what Trevor suggested here
$('.container').find('input, textarea, button, select').attr('disabled','disabled');
Fiddle
works fine with Chrome/Mozilla/IE 10,9,8