I have an input address field with a custom form validation. I would like to disable only the leading space when user starts typing some text
I have checked this post however, this approach disables white space completely
I have also tried using .trim() method along with .replace(/(^\s*)|(\s*$)/gi, "") still didn't work
Here is how it looks when I have leading whitespace.
Having leading whitespace doesn't let form validation error message to be displayed
Please Note my component is a child component and I am looking for a solution which can be implemented within my component.
Need some help
Tried this approach but it disables all spaces by default
<input
v-on:keydown='key'
class="input search-city"
type="text"
placeholder="Street address or zip code"
v-model="search_string"
/>
<script>
methods: {
key: function(event){
if(event.keyCode === 32){
event.preventDefault();
}
}
}
</script>

