Swipeout not working in template pages

$$(’.alert-reply’).on(‘click’, function () {
app.dialog.alert(‘Reply’);
});

Hi, why this above shown code is not working in <template> ? In app.js and html in index.html it works fine. But on another template page it is not working. What can I do?

can you share your template code. I’m guessing you misuse the tags of the component. but just guessing…

1 Like

HTML code:

  •       <div class="item-inner">
            <div class="item-title-row">
              <div id="name" class="item-title">name</div>
              <div id="price" class="item-after">price</div>
            </div>
            <div id="duration" class="item-subtitle">duration</div>
            <div id="description" class="item-text">description</div>
          </div>
        </a>
      </div>
      <div class="swipeout-actions-left">
        <a href="#" class="color-green swipeout-overswipe alert-reply">Share</a>
        <a href="#" class="color-blue alert-forward">Forward</a>
      </div>
      <div class="swipeout-actions-right">
        <a href="#" class="open-more-actions">More</a>
        <a href="#" class="color-orange alert-mark">Mark</a>
        <a href="#" data-confirm="Are you sure you want to delete this item?" class="swipeout-delete">Delete</a>
      </div>
    </li>
    

    JavaScript Code:

    $$(’.swipeout-delete’).on(‘click’, function () {
    app.dialog.alert(‘Reply’);
    });

    This is not giving me the app.dialog.alert after clicked on delete. I am trying to achieve that when clicked on delete, a confirmation pop-up comes to ask if the user really wants to delete it. If yes then delete it. If no then do nothing and just close the pop-up. However the data-confirm="Are you sure you want to delete this item?" gives me the popup but I still have not figured out how to make an "if"statement based on the popups confirmation or cancellation. I tried also onclick=“callFunction()”, however this is executed right after the click on “delete” in stead of being executed after the pop-up data-confirm="Are you sure you want to delete this item?" confirmation.

  • share your full code, just ctrl+c -> ctrl+v your code.
    wrap it in ticks three -> `
    do not split it in part. i want to know how you declare your template. not the code inside.