Trim the string and then check for space
var hasMultipleWords = input.trim().indexOf( " " ) != -1; //returns true if there is a space
More Related Contents:
- How can this page scroll (it doesn’t work properly)?
- What is the difference between properties and attributes in HTML?
- Set the value of an input field
- changing source on html5 video tag
- Why does this simple JSFiddle not work?
- HTML email with Javascript [closed]
- Prevent form submission with enter key
- focus doesn’t work in IE
- Download Canvas as PNG in fabric.js giving network Error
- React: how to load and render external html file?
- What events does an fire when its value is changed?
- html5 display audio currentTime
- How to add background-image using ngStyle (angular2)?
- What’s the difference between putting script in head and body?
- HTML2canvas generates Blurry images
- How to open specific tab of bootstrap nav tabs on click of a particuler link using jQuery?
- update textarea value, but keep cursor position
- HTML5 video, how to detect when there is no audio track?
- Save canvas as jpg to desktop [duplicate]
- How do you float elements without a vertical gap?
- How can I prevent a click on a ‘#’ link from jumping to top of page?
- Get elements from page.evaluate in Puppeteer? [duplicate]
- How can I delete a window.history state?
- NewLine escape character not working
- How can I duplicate a div onclick event?
- Refresh element generated by a django template
- Is there a way to know if a link/script is still pending or has it failed
- How can I dynamically highlight strings on a web page?
- copying the value of a form’s file input field to another form’s input field
- Bootstrap Dropdown menu is not working