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.

dynamic document.getElementById

Featured Replies

Hi, so as the topic suggests im looking to be pointed in the right direction on how to dynamically get an ID.

$('.updateEasyPieChart').on('click', function(e) {
 e.preventDefault();
 $('.percentage, .percentage-light').each(function() {
 var newValue = document.getElementById(1).innerHTML;
 $(this).data('easyPieChart').update(newValue);
 $('span', this).text(newValue);	
 });
 });

 

here is the piece of code which needs editing, im not looking for someone to do it for me, i want to do it myself...i would just like someone to give me some helpful info on how to do it.

 

The 1 inside

document.getElementById(1)

 

Needs to be called dynamically throught the links below...the id of each link is sequential 1, 2, 3 etc...When that link/button is clicked, I somehow need the id of the link to be passed into the document.get...understand what i mean?

 

<li><a href="#" id="1" class="button updateEasyPieChart">70</a></li>
<li><a href="#" id="2" class="button updateEasyPieChart">60</a></li>
<li><a href="#" id="3" class="button updateEasyPieChart">50</a></li>

 

If you look here at this quick link, you can see what im basically trying to get working by clicking the button 70. When 70 is clicked, the value in the pie chart changes (none of the other work as it is calling only id 1)

http://fifamatchgene...chart/examples/

 

Im not the best with javascript...so any help is appreciated. Thanks!

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.