Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

how do i dynamically assign classes to DIV's ... Somehow!?

Featured Replies

If you've got a one instance of a variable (not sure if variable is the correct term) in a script is it possible to wrap it in a div and give each instance a unique class?

 

e.g: revealVoucher_01, revealVoucher_02

 

this is the code which is retrieved using curl, unfortunately i don't have access to the database.

 

 

<section>
<div id="revealVoucher">
<a href="<?=$affiliate_url?>" target="_blank">Reveal Code</a>
</div>

<div id="voucherCode">
<a href="<?=$affiliate_url?>"><?=$voucher_code?></a>
</div>
</section>

Edited by john3y

Without fully understanding your post, to achieve what you're asking for in the subject, you would use JQuery:

 

$('#revealVoucher').addClass('revealVoucher_01');

 

You can change the class name to a php variable if that's what you need to do. I have to say though, if they're going to be unique, I wouldn't use classes.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.