javascript - How can i rearrange words in a div -


I've got a div with words separated by commas

EDIT: Dynamically generated words

To make access to DOM easier:

  Var content = $ ('# mydiv'). Text (); // Get current content from page var word = content.split (','); // Every four words (but not earlier) the word [i] + = ' Pauses for words (var i = 3; i & lt; words.length; i + = 4) {/ // Attachments < Br> } Content = words.join (''); // and empty space $ ('# mydiv'). Join again with Html (content); // and put it back in the page   

NB: I do not see .html () otherwise & lt; Br> gt; Tags will not be rendered properly.

Comments