Answered

Using jquery to change a text element

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


  • 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

  • Think I figured this out:


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

Login or Signup to post a comment