I am not sure if I am asking this right, but basically i am trying to simplify my code so I don't have to write the same thing 5 times. I have included two samples below. You can see that the only thing that changes is the event.X and the ".ia-event-x".
// For title
if (event.title) {
$(".ia-event-title").html(event.title);
$(".ia-event-title").addClass('ia-populated');
}
else if (!event.title) {
$(".ia-event-title").removeClass('ia-populated');
}
// For Description
if (event.description) {
$(".ia-event-description").html(event.description);
$(".ia-event-description").addClass('ia-populated');
}
else if (!event.description) {
$(".ia-event-description").removeClass('ia-populated');
}
Aucun commentaire:
Enregistrer un commentaire