Treehouse: Grow your CSS skills. Land your dream job.

jQuery functions

  • # July 5, 2010 at 4:08 am

    Hey guys, is there a way of doing a function on a jquery object without having to do this:?

    $(this).width(‘img’, this).width());

    I just want to be able to use the $(this) without having to do the .each()

    # July 6, 2010 at 1:14 am

    Try this:

    jQuery.fn.exampleName= function() {
    return this.width(‘img’, this).width());


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.