BobbyJones BobbyJones - 11 months ago 30
HTML Question

How to ignore whitespacing in input boxes

I need your help,

Normally when a user inputs data, how can the code be modified below so as to program it to ignore any whitespacing ie. "a blank keyboard space"

Here is the HTML markup in question:

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript">

window.onload = function() {

$("#fileno").bind("input", function(e) {


$('#save').prop('disabled', false)

});

}

</script>

</head>

<body>

<input type="button" value="save" id="save" disabled>

</body>

</html>

Answer Source

Use the Trim function

https://www.w3schools.com/jsref/jsref_trim_string.asp

fieldName = element.property.Trim()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download