Hi Knal, You need to have the function available before you try and call it. Try putting the $.fn.extend at the top of your script...
-------------- <div class="project"> </div> <script type="text/javascript" language="javascript"> $(document).ready(function(){ $.fn.extend({ initSlides: function() { alert('initSlides'); var t = $(this).attr( "id" ) $( "#" + t + " img" ).hide() } }); if( !$( "div.introbody" ).length ){ $( ".project" ).initSlides() } }); </script> -------- (I threw in an alert just to make sure it was firing!) Cheers, Gus On Thu, Jan 14, 2010 at 7:38 PM, knal <knalp...@gmail.com> wrote: > Hi there, > > I have a function/plugin (below this message) which should fire after > it is checked that div.introbody > doesn't exist. There is only a single div.project on the page for sure > but i don't know how to fire the > function. I've been struggling with this all night! Any help will be > greatly appreciated! > > Thanks, Knal > > > $(function(){ > > if( !$( "div.introbody" ).length ){ > $( ".project" ).initSlides() > } > > $.fn.extend({ > > initSlides: function() { > > var t = $(this).attr( "id" ) > > $( "#" + t + " img" ).hide() > > } > > }) > > }); >