2

http://jsfiddle.net/FT4CQ/5/

cannot manipulate style, I think I got everything ready but it doesn't work, I test with alert() and it fired.

what is wrong here:

$(document).ready(function() {
    $(".cell").mouseover(function() {
    $('this').css('opacity','0.4');
}); 

});
1
  • this should not be in Single quote this Commented Dec 21, 2013 at 8:44

6 Answers 6

3

do this:

 $(this).css('opacity','0.4');

instead of 'this', see the fiddle

Sign up to request clarification or add additional context in comments.

Comments

1

Try this by removing the quotes from this:

$(this).css('opacity','0.4');

instead of

$('this').css('opacity','0.4');

WORKING FIDDLE

1 Comment

@RahulPatil:- Yes he was few seconds quicker than me and thats why he got the upvotes ;)
1

Needs to be

$(this)

Instead of

$('this')

The latter would look for an HTML tag of this

Comments

1

Should be using:

 $(this).css('opacity','0.4');

Working Fiddle

2 Comments

Answered already by Manish... How if we see the previous answers before submitting a new one sir?
It was not there before i started answering it.
1

Here, you are treating this as keyword. Hence, it does not need quotes around.

Write:

$(this).css('opacity','0.4');

instead of

$('this').css('opacity','0.4');

Updated fiddle here.

Comments

1

you are mistakenly treating this as a string by enclosing it in quotes. just remove the quotes

i have updated it as Here

$(document).ready(function() {
$(".cell").mouseover(function() {
$(this).css('opacity','0.4'); // HERE
}); 

});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.