Using jquery to change a text element

Posted over 7 years ago by a barton

Post a topic
Answered
a
a barton

Hi,


I'm trying to figure out how to update text elements in a product designer within woocommerce product page, using jquery. I've taken a look through http://jquerydoc.fancyproductdesigner.com/ but its not immedietely clear to me how to target specific text elements that I've set up in a product designer canvas.


Ideally, I'd like to be able to do something like:


$productDesigner[getElementByID['textline1'].value = "new value"

$productDesigner[getElementByID['textline2'].value = "another new value"


...but I can't figure out what the ID of text elements created it (chrome inspect not telling me anything useful). Is there a way to achieve this?


Thanks,

A Barton


0 Votes

a

a barton posted over 7 years ago Best Answer

Think I figured this out:


fancyProductDesigner.setElementParameters({text:"this is the new text"},"TITLE OF TEXT ELEMENT");

0 Votes


2 Comments

Sorted by
a

a barton posted over 7 years ago Answer

Think I figured this out:


fancyProductDesigner.setElementParameters({text:"this is the new text"},"TITLE OF TEXT ELEMENT");

0 Votes

a

a barton posted over 7 years ago

Hi,


I've made some progress on this, but I'm pretty sure this is not a very clean/efficient way to do it. Any thoughts/improvements? The below changes the text of the text element which has title "Line 1".


jQuery("#fancy-product-designer-66 span[title='Line 1']").text("changed");


Thanks,

Aengus

0 Votes

Login or Sign up to post a comment