This is my code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
<span class='whocares'><div class='box'><span style='font-size:20px;color: #0BB;'>12/26/2012 is the best</span></div><br></span><span class='whocares'><div class='box'><span style='font-size:20px;color: #0BB;'>12-26-2012</span></div><br></span><span class='whocares'><div class='box'><span style='font-size:20px;color: #0BB;'>messa coockcook</span></div><br></span><script>
$(document).ready(function() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
$(".whocares:not(:contains('" + month + "/" + day + "/"+ year+"'))").remove();
});
</script>
It works on JSFiddle, but not on my server.
On my server, nothing appears when I run it.
Why is this so? What did I do wrong?
Thanks in advance!
Firstly, view your source:
Secondly, you need to consider for people in different timezones. For example I am in the IST timezone so here it’s 27/12/2012 already.
Besides that your HTML is not well formed.
You need a closing
</script>here. It’s one of the reasons why you can’t see your error on the server.It always helps to keep well indented code. Easy to spot such errors in crucial spots.