I'm trying to solve the jquery draggable, there is code that retrieve information from database, each information show in each BOX from each row of database.
The draggable are works fine, and also works fine when drag to delete box, but each box comes with button called "remove" and i'm trying to understand how can i write array code in jquery for user to click remove button to remove specific box NOT all box same time.
thanks for your time.
please see code..
- <?php
- include('dbcon.php');
- $product_id=$_POST['selector'];
- $N = count($product_id);
- for($i=0; $i < $N; $i++)
- {
- $result = mysql_query("SELECT * FROM product where product_id='$product_id[$i]'");
- while($row = mysql_fetch_array($result))
- { ?>
- <div class="draggable" id="draggable[]" style="width:300px; height:200px">
- <div class="thumbnail">
- <div id="remove"><a class="button" href="#"><span class="search-icon">remove</span></a></div>
- <div class="control-group">
- <label class="control-label" for="inputEmail">product id</label>
- <div class="controls">
- <input name="member_id[]" type="hidden" value="<?php echo $row['product_id'] ?>" />
- <input name="firstname[]" type="text" value="<?php echo $row['product_name'] ?>" />
- </div>
- </div>
-
- <div class="control-group">
- <label class="control-label" for="inputEmail">product category</label>
- <div class="controls">
- <input name="lastname[]" type="text" value="<?php echo $row['product_category'] ?>" />
- </div>
- </div>
- <div class="control-group">
- <label class="control-label" for="inputEmail">product price</label>
- <div class="controls">
- <input name="middlename[]" type="text" value="<?php echo $row['product_price'] ?>" />
- </div>
- </div>
- </div></div>
- <br>
-
- <?php
- }
- }
- ?>
and in jquery code
- $(function() {
- $(".draggable").draggable();
- $('#trash').droppable({
- over: function(event, ui) {
- $(ui.draggable).remove();
- }
- });
- });
- $(document).ready(function(){
- $("#remove").click(function(){
- $(".draggable").parent().remove();
-
- });
- });