JavaScript. 2 issues

Aug 24, 2010 18:46

Hello ( Read more... )

Leave a comment

Comments 3

hipmaestro August 25 2010, 02:01:58 UTC
It's hard to diagnose your problem without seeing more of your code, but for the second part, assuming ClickIMG is a function you've defined, try this:

Instead of...
$('.Pics').Click('ClickIMG');

Try...
$('.Pics').click(ClickIMG);

(Lower-case c in click, and no quotes around 'ClickIMG'.)

Reply


klip_art December 4 2010, 08:48:52 UTC
If you trying to catch the element inside the event try use jquery selector with "this" passed as a selector -> $(this)

To get the value of some attribute just use $(this).attr('id')

For example, when you want to get the id of your image when it's been clicked, write something like that:

$('.Pics').live('click',function(e){
alert('The class of the clicked element is: ' + $(this).attr('class');
});

Reply

klip_art December 4 2010, 08:50:54 UTC
To catch class, not the id, :-) sorry for the mistake

Reply


Leave a comment

Up