Forum closed. New forum available at http://community.wymeditor.org/

JS newbie needs some help - custom containers and so on

Support forum for WYMeditor.

Re: JS newbie needs some help - custom containers and so on

Postby mr_lundis on Sun Oct 12, 2008 4:38 pm

Yes, e.target is, as you said, the element that originally triggered the event. But instead of giving that element an temporary id to be able to access it later on, I'd suggest you to pass it as an parameter to the function you mentioned.

An example:
Code: Select all
function manipulateImage (image) {
    image = jQuery(image);
    // Play around with it as you like
    image.attr('src', 'new-img.png');
}

jQuery(wym._doc.body).click(function (e) {
    if ($(e.target).is('img')) {
        manipulateImage(e.target);
    }
});
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden

Re: JS newbie needs some help - custom containers and so on

Postby lamy on Sun Oct 12, 2008 4:50 pm

Ah!

You do know that you're kinda awesome, don't you!? :D

Thank you very much. I hope that this was the last question for a while so you can go on working on version 0.6 :D


Have a nice rest of your sunday!
lamy.
lamy
 
Posts: 9
Joined: Wed Aug 27, 2008 2:34 pm

Previous

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest