Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Pour chaque boutique, on récupère le code postal complet (5 caractères).
- $('.shop-zipcode').each(function(){
- var getShopZipcode = $(this).text();
- // On tronque chaque code postal récupéré pour ne conserver que les 2 premiers caractères
- // et on l'affiche dans le DOM via un data-attribute.
- $(this).closest('li').attr('data-zipcode', getShopZipcode.substring(0, 2));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement