how do i detect a whitespace "space" in a string.
My string are somtehing like this 0651160403XL 00CBD012
my code:
<input type="text" name="myLabel"><br>
<span></span>
<script>
$("input[name='myLabel']").on('keyup', renderInput);
function renderInput() {
input = $(this).val();
if(input.match("/\s+/g"))
//trim the input to 0651160403XL
});
</script>
but my code is not working. How can i escape the slash in match function?
input.match(/\s+/g)if (/\s/.test(input.trim())) { $(this).val(input.trim().split(/\s/)[0]); }. The question is somewhat unclear.