The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript ‘Load All’ removing html — help? Re: ‘Load All’ removing html — help?


Probably not the most elegant solution but I wanted to see if I could do it :P

First you need to grap the **html** rather than _ text_ from .load-all otherwise it strips out all the html tags.

Further down you’ll see I _append_ **’.morecontent’** because

> var html = c + ‘‘ + h + ‘ ‘+moretext+’‘;

causes some problem where it shortens only the first paragraph to 300 characters and then displays all the rest.

My solution has a problem where the closing p tag is still used after 300 characters. To get around the paragraph space this would cause when displaying **’.morecontent’** I’ve targeted the first p tag to **display: inline**. For this example I also made the ‘.morelink’ display:block to drop it below the text.

Edit: I changed the url above.