I'm looking for the remove button to disappear but only if only there is no .newCar to be found on the page. The class newCar (and newDate) only appear after the Add More button has been added. (I've two different classes here because the field .newDate can't be cloned because I need a new calendar generated each time.)
I've been trying various techniques and my current one is to use the .hasClass method but I'm unsure as to why it's not working.
if ($('.core:last').hasClass('newCar')){
$(this).parents('#form').find($removeBtn).css('display', 'block');
}
else{
$(this).parents('#form').find($removeBtn).css('display', 'none');
}
I've created a fiddle here
Aucun commentaire:
Enregistrer un commentaire