wordpress plugin - How to pass a variable to reveal modal -


hello developing own functionality plugin on wordpress , stuck on trying pass variable page modal opens after link clicked displaying delete confirm dialog

the link opening modal is

<a href="<?php echo $passing_var?>" data-reveal-id="deletemodal" class="deletelink">     <i class="fi-trash size-24 icolored"></i> </a> 

the modal window code

<div id="deletemodal" class="reveal-modal" data-reveal aria-labelledby="modaltitle" aria-hidden="true" role="dialog">     <h2>are sure want delete? <?php echo get_the_title( $passing_var ); ?>  </h2>     <p class="lead">this cannot undone</p>     <a class="deletebutton button" href="#">delete</a>     <a class="close-reveal-modal">&#215;</a> </div> 

how can pass $passing_var main page modal window?

set data attibute

<a data-id="<?php echo $passing_var?>" class="deletelink">     <i class="fi-trash size-24 icolored"></i> </a> 

read data attribute use in modal

$(document).on("click", ".deletelink", function () {      var dataid = $(this).data('id');      $('#deletemodal').modal('show'); }); 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -