javascript - how to reveal coupon code using php -


i want reveal coupon code on button click

  <script type='text/javascript' >    jquery('#id1').click(function(){    jquery(this).replacewith("<?php echo $_coupon?>");   }) </script>   <?php if ($_coupon != '' ):?>  <button   id="id1" type="button" class="but" value="button name">     </button> <?php endif; ?> 

this code works first button click means show 1 value not works loop please me solve problem

i way:

<script type='text/javascript' >    jquery('#id1').click(function(){       jquery(this).replacewith(jquery(this).val());    }) </script>   <?php if ($_coupon != '' ):?>   <button id="id1" type="button" class="but" value="<?php echo $_coupon ?>"></button> <?php endif; ?> 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -