$(function(){
$(".test").each(function(){
test();
});
});
function test(){
$(this).css("border","1px solid red").append(" checked");
}
why is this not working? what am I missing?
this is my test html:
<p>test</p>
<p>test</p>
<p class="test">test</p>
<p>test</p>
The $(this) cannot be used in that way, because you don’t specify the context of the test() function:
or