Why does jquery behave like this
Posted
by andrei
on Stack Overflow
See other posts from Stack Overflow
or by andrei
Published on 2010-06-10T13:40:26Z
Indexed on
2010/06/10
13:52 UTC
Read the original article
Hit count: 157
jQuery
$('.box').click(function(){
$(this).find('p').toggle(
function () {
$(this).css({"color" : "red"});
},
function () {
$(this).css({"color" : "black"});
}
);
});
if i execute this script the 'p' color will change if i click on the 'p' not on the .box class why ? And how to i make it so that 'p' color changes when i click on the .box div
© Stack Overflow or respective owner