PricingBlog

How to add a new div using repeat based on selection?

  • wacksaran-1262705823390634086

    WackSaran

    1 year ago

    On pressing add block, I want a new div to be created to display the next new block. How do i do that? Can you also please help me with how I can show a visualisation of this link/text/photo in the right side canvas in that particular order?
    Image 1: addBlocks variable which is an array that is doing a repeat on the div
    Image 2: the click event on selecting the different blocks and calling addBlocks here.

    The flow: view current blocks > add block cta > add new block in next div > view these blocks on right side visualisation
    1262705824019644447-image.png
    1262705824569229363-image.png
  • andreasmoller-1262716053876637716

    Andreas Møller

    1 year ago

    You can’t create or delete elements dynamically. Instead you can toggle them with show hide
  • wacksaran-1262719031262056550

    WackSaran

    1 year ago

    so instead of using repeat here, ill make a bunch of components and add show/hide functionality as and when it is clicked? but that would still not solve i think because i might want multiple link elements on selecting link, how do i show that? (eg: 1st image)
  • andreasmoller-1262721535433773056

    Andreas Møller

    1 year ago

    No if you are repeating over a list you just need to add an other item to the list
  • wacksaran-1262729833700655105

    WackSaran

    1 year ago

    ohh alright alright, i just appended on a formula and I got it, thank you so much 😄
  • andreasmoller-1262730180003364874

    Andreas Møller

    1 year ago

    👍