Jump to content

andypage

Member
  • Posts

    4
  • Joined

  • Last visited

Everything posted by andypage

  1. @jpeter okay diving deeper into this. Let's say i wanted to dynamically set elements for a button (both the button text and the href) I'm thinking i would have to do this blockId: "block-yui_3_17_2_1_1669044754565_76599", blockIdSelector: "a", link: "google.com", parameterName: "button_link" }, { blockId: "block-yui_3_17_2_1_1669044754565_76599", blockIdSelector: "a", text: "", parameterName: "button_text" }, and then something link this function init(){ BLOCKS_TO_UPDATE.forEach(item => { item.blockId.replace('#', ''); var parameterValue = getParameterByName(item.parameterName); var block = document.querySelector('#' + item.blockId); var blockSelector = block && block.querySelector(item.blockIdSelector); var element = blockSelector || block; if(element && parameterValue){ element.textContent = item.text + ' ' + parameterValue; element.linkContent = item.link + ' ' + parameterValue; } }); } But for some reason I'm not able to get that to work
  2. @jpeter thanks for this script. its awesome. i'm curious, how would you edit that to allow for the ability to pass multiple url parameters to a page that edit different blocks?
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.