Hide all but first word

For example, you have the following html line:

<p><span class=“hideAllButFirstWord”>Aqui dolorit latia corum</span></p>

I only want to display the first word on the page. So instead of:

Aqui dolorit latia corum

you’ll only see the following word on the page:


Anyone know how to do this?

Looks like an assignment to me. Does the hidden text have to be re-displayable?

No, it can also be removed.

This is a really simple one, essentially you could have taken the other code in your other post and modified it quite easily.

Edit this Fiddle - jsFiddle - Online Editor for the Web (JavaScript, MooTools, jQuery, Prototype, YUI, Glow and Dojo, HTML, CSS)

Works perfectly, thank you SgtLegend :slight_smile: