How can I send the value shown in an HTML input box as '030.34' and not '0.34'? I need to prepend '03'for an ID.
I need the input box to be type 'number' so the up down buttons can be used, so I cannot set it to text.
Added: there are limits max min set on the input.
Any ideas? Thanks Chris
function ipFunction() { var c = SETPOINT.value; SETPOINT.value = xxx + c; // prepend '03' HOW??? return true; // can be submitted }
<form id="frmSetPoint" name="frmSetPoint" action="#" onsubmit="ipFunction()" accept-charset="utf-8"> <input type="number" onkeydown="return false" id="SETPOINT" name="SETPOINT" min="1" max="10"> <input type="submit" value="Submit Value"> </form>
I spent a day on this - I'm just learning - but a friend put me right. Hopefully this should help others.
$("#frmSetPoint").validate({
submitHandler: function (form) {
var serializedData = $(form).serialize();
serializedData = serializedData.replace("=", "='P03") + "'";
$.ajax({
url: '/value.cgi',
data: serializedData,
type: 'GET',
success: function (data) {
},
error: function (data) {
$(currentButton).prop('disabled', false);
$(currentButton).css({
color: '#ffffff',
backgroundColor: '#00FF00'
});
}
});
return false;
}
}); //validate
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.