I am working with an API that accepts an array of strings from an input field called #tags. What is the best way to do that? It should also remove any commas between the "tags" and be [] if no tags.
input: tag1, tag2, tag3 becomes: ["tag1", "tag2", "tag3"]
HTML
<input id="tags" type="text" placeholder="tags" name="" value="">
how im currently getting the tag value:
createPost('canvasID',{tags:$('#tags').val()});
myString.split(',')will become["tag1", "tag2", "tag3"]