Reputation: 1380
If I go to this jsfiddle and change the code so it looks like this jsfiddle, the former works as expected, i.e., I get a 13px red border around some of my elements. But on the latter, the exact same code doesn't produce the borders. I've looked at settings and external resources for both, but they look identical. It's probably something obvious but I'm just not seeing it. (SO is requiring me to post code, so here is the code in the second jsfiddle):
html:
<div class="myclass">NOT This Guy</div>
<div class="myclass otherclass">This Guy</div>
<span class="myclass otherclass">This Guy</span>
<span class="myclass otherclass anotherclass">This Guy</span>
<span class="otherclass">NOT This Guy</span>
javascript:
$(".myclass.otherclass").css("border", "13px solid red");
Why does that code only work when I use it in the former but not the latter jsfiddle (or any other new jsfiddle I create)?
Upvotes: 0
Views: 40
Reputation: 60190
Your second fiddle runs in no-library mode, but the JS code you wrote needs jQuery to work. Add that and it does put the red border as expected...
(To add jQuery, click on the gear symbol by the JavaScript label, e.g. near the middle of the screen.)
Upvotes: 2