I am making a scholarship website for my school and I am wanting to add a class to the scholarships if the scholarship due date has passed. Each scholarship has the class .month.
HTML
<li class="month 11 start" data-due-date="11/11/2014 1:00">
<time class="cbp_tmtime"><span>Nov. 11, 2014</span></time>
<div class="cbp_tmicon"></div>
<div class="cbp_tmlabel">
<h2>November</h2>
<p>Peanut gourd nori welsh onion rock melon mustard jícama. Desert raisin amaranth kombu aubergine kale seakale brussels sprout pea. Black-eyed pea celtuce bamboo shoot salad kohlrabi leek squash prairie turnip catsear rock melon chard taro broccoli turnip greens. Fennel quandong potato watercress ricebean swiss chard garbanzo. Endive daikon brussels sprout lotus root silver beet epazote melon shallot.</p>
<br>
<a href="#">Website</a> | <a href="#">PDF</a>
</div>
</li>
<li class="month 12 start" data-due-date="12/11/2014 1:00">
<time class="cbp_tmtime"><span>Dec. 11, 2014</span></time>
<div class="cbp_tmicon"></div>
<div class="cbp_tmlabel">
<h2>December</h2>
<p>Parsley amaranth tigernut silver beet maize fennel spinach. Ricebean black-eyed pea maize scallion green bean spinach cabbage jícama bell pepper carrot onion corn plantain garbanzo. Sierra leone bologi komatsuna celery peanut swiss chard silver beet squash dandelion maize chicory burdock tatsoi dulse radish wakame beetroot.</p>
<br>
<a href="#">Website</a> | <a href="#">PDF</a>
</div>
</li>
Jquery
function getData(){
var scholarship = $('.month');
var data = $(scholarship).data("due-date");
var dataDate = new Date(data);
var today = new Date();
if(dataDate < today){
}
}
I have looked for days for ways to do this but i couldn't figure it out. This is as far as i got. Please help :/ this has been irritating me like crazy. Thank you!
Aucun commentaire:
Enregistrer un commentaire