Tomislav Tomi Nikolic Tomislav Tomi Nikolic - 1 year ago 126
Javascript Question

Spliting sentence into words

Hey guys so I am basically trying to split entire input into words and then display it (possibly store it inside variables or an array so I can display it later). So far I made a system to count the words but I have to also split them so I can use them.
Words are separated by space " "

$(document).ready(function() {
$("form").on("submit", function (e) {

var words = $.trim($("#command_text").val()).split(' '); /* Count words*/



Answer Source

Add this to your code and you will see that you have already stored them into an array as DelightedDOD states.


Once you have done that, you may want to close the question.

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