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 .
×

Need help implementing tabs and multiple dropdown selection boxes

What it says on the tin so to speak. Working on a mechwarrior type game with PbtA and looking at needing players to be able to access three sheets and wanting to do them as tabs to swap between them fairly readily. The other part of it is that I'm looking at using some drop down selection lists for playbook selections and such, one on each tab. My issue here is that using the suggested code from the R20 wiki doesn't seem to work when I try to add in the code for the drop down boxes to the CSS. It seems to end up breaking either the tab switching or the selection box. I'm not sure where I'm losing the plot so to speak. So I'm wondering if anyone has a base code layout for something like this they'd be willing to share that I can reference to see what's going on with the code and try to figure out where I'm going completely wrong. 
1635523605

Edited 1635553811
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
If you can share your code, that'd help with diagnosing the problem. I'm not sure I'm understanding how the selects and the tabs could be interacting with each other. But in broad terms, I'd probably take advantage of new features (namely limited jQuery implementation) that have been released to do this like so: * Note that for a full implementation you'd need to store the currently active sheet somewhere and reset the active section on('sheet:opened'). HTML/Sheetworker < button type = 'action' class = 'sheet-tab' name = 'act_sheet-1' >Access Sheet 1</ button > < button type = 'action' class = 'sheet-tab' name = 'act_sheet-2' >Access Sheet 2</ button > < section class = 'sheet-1' >   < h1 >Sheet 1</ h1 >   < select name = 'attr_playbook-1' >     < option value = 'option 1' >1</ option >     < option value = 'option 2' >2</ option >   </ select > </ section > < section class = 'sheet-2' >   < h1 >Sheet 2</ h1 >   < select name = 'attr_playbook-2' >     < option value = 'option 1' >1</ option >     < option value = 'option 2' >2</ option >   </ select > </ section > < script type = 'text/worker' >   const sheetTabs = ['sheet-1','sheet-2'];   const sectionSwap = function(jEvent){     let target = jEvent.htmlAttributes.name.replace(/act_/,'');     sheetTabs.forEach((tClass)=>{       if(tClass === target){         $20(`section.${tClass}`).addClass('active');       }else{         $20(`section.${tClass}`).removeClass('active');       }     })   };   $20('.sheet-tab').on('click',sectionSwap); </ script > CSS section {   display : none ; } section .active {   display : grid ; }
Thanks for the response. Yeah, sorry I didn't think about posting up the code which is on me. <a href="https://pastebin.com/NV4riK39" rel="nofollow">https://pastebin.com/NV4riK39</a> &nbsp;for the HTML <a href="https://pastebin.com/bF0BJce7" rel="nofollow">https://pastebin.com/bF0BJce7</a> &nbsp;for the CSS