Search code examples
cssinputradio-buttonyuisquarespace

YUI Squarespace CSS manipulation


I am relatively new to Squarespace and using YUI (Yahoo! User Interface Library), and I need some help being able to target and change "input[type=radio]:checked" to take on the CSS styling .menuradio {text-decoration:none !important; border-bottom: 4px solid #000;}

That said, I am having trouble targeting this piece of code with just CSS:

<div class="sqs-block menu-block sqs-block-menu" data-block-type="18" id="block-yui_3_17_2_1_1412637006352_21955">
  <div class="sqs-block-content" id="yui_3_17_2_1_1414597475438_1924">
    <div class="menu-wrapper menu-style-classic" id="yui_3_17_2_1_1414597475438_1923">
      <input type="radio" name="menu-selector-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" id="menu-select-all-day-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-button">
      <input type="radio" name="menu-selector-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" id="menu-select-brunch-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-button menuradio">
      <input type="radio" name="menu-selector-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" id="menu-select-dessert-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-button">
      <input type="radio" name="menu-selector-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" id="menu-select-wine-list-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-button">
      <input type="radio" name="menu-selector-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" id="menu-select-gluten-free-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-button">
      <div class="menu-selector" id="yui_3_17_2_1_1414597475438_1922">
        <label id="navbuttontop" for="menu-select-all-day-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-labels menu-label-all-day-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3 menuradio">ALL-DAY</label>
        <label id="navbuttontop" for="menu-select-brunch-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-labels menu-label-brunch-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3 menuradio">BRUNCH</label>
        <label id="navbuttontop" for="menu-select-dessert-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-labels menu-label-dessert-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3 menuradio">DESSERT</label>
        <label id="navbuttontop" for="menu-select-wine-list-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-labels menu-label-wine-list-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3 menuradio">WINE LIST</label>
        <label id="navbuttontop" for="menu-select-gluten-free-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3" class="menu-select-labels menu-label-gluten-free-yui_3_17_2_1_1412637006352_21955-28f6eb3b-5f85-4155-a233-f0c262fef2a3 menuradio">GLUTEN-FREE</label>
      </div>

...

What class should I be targeting before the input?

Am I on the right track by using this script?

Y.all('input:checked').addClass('menuradio');

or

Y.all('label').addClass('menuradio');

or

Y.one('#block-yui_3_17_2_1_1412637006352_21955 input[type=radio]:checked').addClass('menuradio');

or

Y.all('.menu-wrapper .menu-style-classic input[type=radio]:checked').addClass('menuradio');

?

Nothing seems to be working...

Thanks in advance for any input ;)


Solution

  • You almost got it (probably already did by now). This should work:

    Y.all('input[type=radio]:checked').addClass('menuradio');
    

    Do keep in mind YUI is dying and due to that Squarespace will probably change it in the future, although it may take a while. But still, I mean, I don't see any reason to not use jQuery instead of old dead YUI! ;P