I would like simulate input disabled. I would like don't have change value in input, but this value should be send with POST with FORM.
<input class="dis" type="text" disabled="disabled" value="111">
<input class="no" type="text">
<input class="dis" type="text" disabled="disabled" value="333">
/
I can use also CSS and jQuery, but how?
I would like simulate input disabled. I would like don't have change value in input, but this value should be send with POST with FORM.
<input class="dis" type="text" disabled="disabled" value="111">
<input class="no" type="text">
<input class="dis" type="text" disabled="disabled" value="333">
http://jsfiddle.net/hC4WP/
I can use also CSS and jQuery, but how?
Share Improve this question edited Apr 19, 2012 at 10:30 Felix Kling 816k180 gold badges1.1k silver badges1.2k bronze badges asked Apr 19, 2012 at 10:27 Ron ForzesteringRon Forzestering 872 silver badges5 bronze badges 3 |3 Answers
Reset to default 12Use the readonly
attribute instead of disabled
.
However, this will not result in the field being grayed out. To achieve this, use the following CSS:
input[readonly] { color: #aaa; }
(you might have to change the color a bit to look more like the original disabled color)
Use readonly
instead of disabled
Solution with tabindex.
Create a .disabled class.
CSS:
.disabled {
pointer-events:none; /* No cursor */
background-color: #eee; /* Gray background */
}
JS:
$(".disabled").attr("tabindex", "-1");
HTML:
<input type="text" class="disabled" />
readonly
. – Felix Kling Commented Apr 19, 2012 at 10:29readonly
allows you to modify it. You should do something like this: stackoverflow.com/questions/368813/… – Sonhja Commented Sep 21, 2017 at 13:50