Question about is() function
- HTML
- <ul>
- <li>i have <strong>one</strong> here and <strong>another</strong></li>
- <li>i have only <strong>one</strong></li>
- </ul>
- $('li').click(
- function()
- {
- var isTwo=$(this).is(
- function()
- {
- return $('strong',$(this)).length==2;
- }
- );
- if (isTwo)
- {
- $(this).css('background','green');
- }
- else
- {
- $(this).css('background','yellow');
- }
- }
- );
My question is what does $(this) in $(this).is(.............) do here? If I change to $('strong').is(..........) it doesn't work as expected.