$(document).ready(function () {
$(div.clickable_element p).click( function () {
$(this).parents(div.clickable_element).toggleClass(selected);
});
});
spaceage wrote:
A question re: event handling/propagation: I have a surrounding div
and I want any click within the div (including
OK, so you have to independently assign a handler to all descendant
elements in the div? Is there no better way via the parent div?
On Feb 20, 8:07 am, Liam Potter radioactiv...@gmail.com wrote:
$(document).ready(function () {
$(div.clickable_element p).click( function () {
I think it should be also working just this way:
$('#mydiv').css('cursor','pointer').click(function(){
$(this).addClass('selected');
});
No need to select all the contents manually.
On Feb 20, 5:16 pm, spaceage spaceageliv...@gmail.com wrote:
OK, so you have to independently assign a handler
Actually, this works nicely (I think because of the use of this vs.
event.target?):
$('div.clickable_element').click(function() { $(this).toggleClass
(selected); });
On Feb 20, 8:28 am, Frederik Ring frederik.r...@gmail.com wrote:
I think it should be also working just this way:
I only used parents() and selected the P as that is what I understood
spaceage wanted.
spaceage wrote:
Actually, this works nicely (I think because of the use of this vs.
event.target?):
$('div.clickable_element').click(function() { $(this).toggleClass
(selected); });
On Feb 20, 8:28 am,
5 matches
Mail list logo