JavaScript
Article
By Sam Deering

Adding Custom Messages to Code Snippets Displayed on Your Web Page

By Sam Deering
Help us help you! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min

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:

--ADVERTISEMENT--

/* Append "Double Click to Edit Code" to code displays */
setTimeout(function() {
     $('.syntaxhighlighter').prepend('double click code to edit/copy');
}, 5000);
Login or Create Account to Comment
Login Create Account
Recommended
Sponsors
Get the most important and interesting stories in tech. Straight to your inbox, daily.Is it good?