jQuery and Highslide JS

08 January 2008   4 comments   Javascript


Mind That Age!

This blog post is 10 years old! Most likely, its content is outdated. Especially if it's technical.

If you use the wonderful Javascript library jQuery and the wonderful (standalone) Javascript plugin Highslide JS of recent version you should be aware of something.

As of recent versions of Highlide the way the Expander function works is that it looks at an element's onclick attribute and not it's attached events which means that if a DOM element has the event but not the attribute you get a Javascript error. In older versions of Highslide you were able to do this:

$('a.highslide').click(function() {
   return hs.expand(this, options);

But that's no longer working since the attribute isn't set. Here's the new way of doing it:

$('a.highslide').each(function() {
   this.onclick = function() {
     return hs.expand(this, options);



Hi Peter!
I would like to call up Highslide for every markup putting this script in the header...but it doesn't work! Could you maybe help? Thank you!! ~Lukas

<script type="text/javascript">
this.onclick = function() {
return hs.htmlExpand(this, { objectType: 'iframe' } );

Peter Bengtsson

I think there's a forum on the Highslide website. Ask there.


Hi, Lukas!
Try putting that script in the body of the document.


//or just use it like this ;)

$(document).ready(function() {
$('a.highslide').each(function() {
this.onclick = function() {
return hs.expand(this);

Your email will never ever be published

Related posts

The Love Mattress 06 January 2008
input/textarea switcher with jQuery 11 January 2008
Related by Keyword:
Some tips on learning React 04 August 2015
Difference between $.data('foo') and $.attr('data-foo') in jQuery 10 June 2012
QUnit testing my jQuery Mobile site in full swing 17 March 2011
Why I gave up on JQuery UI's autocomplete 20 October 2010
In jQuery, using the :visible selector can be dangerous 14 September 2010
Related by Text:
jQuery and Highslide JS 08 January 2008
I'm back! Peterbe.com has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
Ever wondered how much $87 Billion is? 04 November 2003
Guake, not Yakuake or Yeahconsole 23 January 2010