Adding Custom Messages to Code Snippets Displayed on Your Web Page

Sam Deering

Hi guys, just a quick post to show you how to add custom messages to your code snippets that you are displaying on your web page. An example is on the blog below (code shown below look at the top right hand corner) where I wanted to add extra usability to the code snippets by tell you that you can double click them to edit or copy the code held within them. Which I thought was not particularly obvious, especially if you have not seen it done before.

Related Posts:

/* Append "Double Click to Edit Code" to code displays */
setTimeout(function() {
     $('.syntaxhighlighter').prepend('<span style="float:right;color:#F45116;font-size:10px">double click code to edit/copy</span>');
}, 5000);

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

No Reader comments

Comments on this post are closed.