Skip Navigation

[Resolved] Multiple modals on same page not working

This support ticket is created 5 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by martinH-10 5 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1259745

I have button in each Loop for opening modal.

<div class="prace-vypis">
  <div class="row">
	<div class="col-sm-8"><p class="vypis-title"><a href="[wpv-post-url]" target="_blank" title="Prohlédnout pracovní pozici: [wpv-post-title]" rel="noopener noreferrer">[wpv-post-title]</a></p>
<p class="vypis-subtitle">[wpv-post-taxonomy type="uvazek" format="name"] / [wpv-post-taxonomy type="obor" format="name"] / [wpv-post-taxonomy type="lokalita" format="name"]</p></div>
    <div class="col-sm-4"><p class="vypis-time">Přidáno: [wpv-post-date format="j. F"]</p></div>
</div>
<div class="row">
	<div class="col-sm-8"><p class="vypis-excerpt">[wpv-post-excerpt format="noautop"]</p></div>
	<div class="col-sm-4"><p class="vypis-button"><button type="button" class="btn btn-success" data-toggle="modal" data-target="#nahled-inzeratu-[wpv-post-id]" title="Náhled pracovní pozice: [wpv-post-title]">Náhled <span class="glyphicon glyphicon-search"></span></button></p></div>
</div>
</div>

<!-- Modal -->
<div id="#nahled-inzeratu-[wpv-post-id]" class="modal fade popup-inzerat" tabindex="-1" role="dialog" aria-labelledby="nahledinzeratu-[wpv-post-id]" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" id="nahledinzeratu-[wpv-post-id]">[wpv-post-title]</h4>
      </div>
      <div class="modal-body">
        <div class="row">
	<div class="col-sm-8">[wpv-post-body view_template="None"]</div>
          <div class="col-sm-4 pop-kontakt"><h3>Máte zájem?</h3>
          <p>Napište nám:<br>[wpv-post-author format="meta" meta="user_email"]</p>
          <p>Zavolejte nám:<br><i class="material-icons">phone</i> [types usermeta='tel' user_is_author='true'][/types]</p>
          <a href="[wpv-post-url]" class="btn btn-primary btn-info">Kontaktní formulář <span class="glyphicon glyphicon-chevron-right"></span></a></div>
</div>
         
      </div>
      <div class="modal-footer">
        <a href="[wpv-post-url]" title="Prohlédnout pracovní pozici: [wpv-post-title]" class="btn btn-info">Prohlédnout <span class="glyphicon glyphicon-arrow-right"></span></a>
      </div>
    </div>
  </div>
</div>

It always have custom id for each loop item set by post-id. Everything looks fine, but modals dont open. Can you help? You can see it here: hidden link - the green buttons should open modals

#1259963

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

well - I see you done mistake with your code.

Please replace the following line of code with your original line of code and it should work:

<!-- Modal -->
<div id="nahled-inzeratu-[wpv-post-id]" class="modal fade popup-inzerat" tabindex="-1" role="dialog" aria-labelledby="nahledinzeratu-[wpv-post-id]" aria-hidden="true">

The issue was you added # with id attribute. The id attribute value should be without hash id="nahled-inzeratu-[wpv-post-id]"

#1260131

My issue is resolved now. Thank you!