This is my HTML and PHP code.
The color box is going well, and it also shows a button.
//This is the Colorbox code <div style="display: none"> <div id="remove"> <h1>Are you sure you wish to remove this product</h1> <h2>Enter Captcha below to confirm</h2> //Just a Captcha-like behavior <input type="text" value="<?php echo $captcha_value; ?>" id="display" readonly ><br /> <br> <input type="text" name="captcha" value="" id="input" maxlength=6/> <br> <br> </div> </div> //To Display all products <?php foreach ($products as $product) { ?> <td> <div> <img src="<?php echo $product['image']; ?>"/> </div> <div> <a onClick="loadColor(<?php echo $product['opv_id']; ?>)" class="remove-item"> <img src="<?php echo $product['product_remove_image']; ?>"/> </a> //To know which product link was clicked </div> </td> <?php } ?> //loadColor function which will append a button to Colorbox <script type="text/javascript"> function loadColor(opv_id) { </script> <script type="text/javascript"> $('#remove-product').click(function() { alert('Clicked'); </script>
Got it :)
So, is there another easy way to achieve what I was trying to do above?
source share