Forum closed. New forum available at http://community.wymeditor.org/

How to hide all paragraphs at once?

Support forum for WYMeditor.

How to hide all paragraphs at once?

Postby madasahatta on Sun Jun 06, 2010 1:24 pm

I've seen in the example css that you can hide paragraphs individually (hidden note class). This causes the paragraph to appear grey in the editor and to disappear in the preview.

I'm building an e-learning app and would like to be able to hide all paragraphs at once by clicking on an external button. This would not apply to any paragraph with the css class 'important' and would result in only highlighted notes appearing in the preview (highlighted notes are paragraphs marked important).

Is there a way of applying the hidden note class to all paragraphs at once?

thanks
madasahatta
 
Posts: 3
Joined: Sun Jun 06, 2010 1:06 pm

Re: How to hide all paragraphs at once?

Postby mr_lundis on Sun Jun 06, 2010 2:33 pm

Untested, but should work:
Code: Select all
var wym = $.wymeditors(0);
jQuery('p:not(.important)', wym._doc).addClass('hidden');

Adjust the class names accordingly, and bam!

Cheers! ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden

Re: How to hide all paragraphs at once?

Postby madasahatta on Sun Jun 06, 2010 5:15 pm

Works great thanks.. :D .
madasahatta
 
Posts: 3
Joined: Sun Jun 06, 2010 1:06 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests