andypage
-
Posts
4 -
Joined
-
Last visited
Content Type
Forums
Gallery
Blogs
Events
Store
Downloads
Profiles
Posts posted by andypage
-
-
@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 thisblockId: "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
-
@jpeter you're incredible - thank you!
-
@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?
Is it possible to create personalised pages with data taken from an appended URL?
in Customize with code
Posted
incredible - appreciate you @jpeter!