Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to toggle between prettified text and raw text
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nathan Ziarek  
View profile  
 More options Mar 30 2012, 4:56 pm
From: Nathan Ziarek <nzia...@gmail.com>
Date: Fri, 30 Mar 2012 15:56:10 -0500
Local: Fri, Mar 30 2012 4:56 pm
Subject: Re: How to toggle between prettified text and raw text

Without knowing how you're loading the source, the quickest option might be to just load it twice (or copy the containing element before applying pretty print)

<div id="source-original" style="display:none"><SOURCE></div>
<div id="source-pretty" class="prettyprint"><SOURCE></div>

Then, when you click your button, just toggle between showing and not showing the DIVs.

nz

On Mar 12, 2012, at 9:16 AM, Ciaran Farrell wrote:

> I'm sure that there must be an easy answer to this, but maybe there isn't. I have a <pre id="bar" class="prettyprinter" wrap></pre> into which I dynamically load the contents of a source code file. It seems to work as the contents are displayed with line numbering and styling.

> However, how should I best add a button/link at the top of the page that allows the user to toggle between prettified and raw versions of the content? Someting like a href with id (e.g. foo) doesn't work:

> $('#foo').live('click',function(){
>   $('#bar').removeClass('prettyprinter');
> });

> --
> You received this message because you are subscribed to the Google Groups "js-code-prettifier" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/js-code-prettifier/-/UlOWFP_YgboJ.
> To post to this group, send email to js-code-prettifier@googlegroups.com.
> To unsubscribe from this group, send email to js-code-prettifier+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/js-code-prettifier?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.