Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

No way to change HTML of sheet with Javascript?

The sheets don't allow "getElementbyID" so does that mean there is no way at all to change HTML? I just want to change the attribute names that are displayed when you select a drop down. Is there no way to do this?
1602286712
GiGs
Pro
Sheet Author
API Scripter
You are correct that there is no way to change the html. If your entire group installs Stylus, you can create a userscript to change things based on CSS, but that might not work for this goal.  As a Pro user, you can grab the sheet's code and install it as a custom sheet, and then just directly edit the drop down to show the values you want. (Though the 5e D&D sheet cant be modded in this way because its code isnt accessible).
1602286939
Spren
Sheet Author
A few more details would be helpful, how are you trying to accomplish this now, and is this only for yourself? You posted in the Api forum, so are you trying to access character sheet elements via the api? As a pro user what you would generally do to change a character is use a custom character sheet. A custom character sheet is basically making a copy the sheet to your game and then making any changes you want to the html/css. With that you could change anything you wanted on a character sheet as long as it was available on the roll20 github page for character sheets.
I'm sorry, I wasn't clear. Let's say I wanted the Agility attribute to display as "Dexterity" for some type of character. So changing how it's displayed elsewhere in the DOM based on the drop down selection. Just trying to avoid having to set up separate tabs for each different type of character.
1602287490

Edited 1602287510
Spren, I'm trying to modify an existing sheet but basically what you said. They use a JSON translation file and I'm trying to change what is displayed based on a js action.  example: <h3 data-i18n="strength">Strength</h3> I can't figure out how to change the name. I've tried getting and setting the attribute but I'm doing something wrong.
1602288784
GiGs
Pro
Sheet Author
API Scripter
roll20 has a built in translation system, those data-i18n references are just used for that. It uses your system's language to decide which value to show you.
How do I change what is referenced from the JSON file though? I can't access that header so how do I change it to data-il8n="agility" for instance?
1602297968
GiGs
Pro
Sheet Author
API Scripter
If you're not using a custom sheet, you can't.