In JavaScript, how can I get the first and last words from an element's text?
For example:
<div class="content">this is a test</div>// output 'this' 'test'
<p>This is another test</p>// output 'this' 'test'
How can I do that? I am not sure how to use RegExp to match them.