Results 1 to 8 of 8
  1. #1

    How to modify code from simple JQuery article?

    Hello, the following article I found shows how to use jquery to click on an image and delete it from an html table row:

    I do not use html tables, I use div tags. How can I modify the code to work with <div> tags please?

  2. #2
    The code deletes a row from the table.
    To delete the image in that case you can probably just use
    $(this).remove(); in the onclick portion of an image.

    Otherwise you need more changes to this part, but I can't see your code to know more:
    'table td img.delete'

  3. #3
    Thanks for the reply. I would like to click on the image to delete the whole row like one of his examples show. Here is my html:

    <div><a href="">Google</a><img src="templates/images/red-x.png" class="delete" alt="Remove site" /></div>
    <div><a href="">Yahoo</a><img src="templates/images/red-x.png" class="delete" alt="Remove site" /></div>

  4. #4
    this should be it basically

    <script src="jquery.js" type="text/javascript"></script>
    <body bgcolor="#FFFFFF">
    <div><a href="#">Google</a><img src="templates/images/red-x.png" class="delete" alt="Remove site" /></div>
    <div><a href="#">Yahoo</a><img src="templates/images/red-x.png" class="delete" alt="Remove site" /></div>

  5. #5
    Great thanks a lot Now I hope I can figure out how to call up the php file with it but that should be easy.

  6. #6
    OK curious, his tutorial is vague in the link I showed you to delete the row from the DB. I know how to do the php part, but do I need to change the html to pass the ID number of the row to delete? He just says to add this code:

    									  $.get('deleteRow.php', {id: $(this).parent().attr('id')},
    but do I need to add some type of html change to pass the ID of the row to be deleted?

  7. #7
    it needs to pass the ID, and I see the id attribute in the call, but I don't know offhand where to enter the ids...

  8. #8
    Sweet I kept messing with it and got it to work! It was easier to do when I tabbed after the brackets so I could read it more easily. Here is the jquery:

    									  $.get('deleteRow.php', {id: $(this).parent().attr('id')});
    here is the html:

    <div id="1"><a href="#">Google</a><img src="templates/images/red-x.png" class="delete" alt="Remove site" /></div>
    <div id="2"><a href="#">Yahoo</a><img src="templates/images/red-x.png" class="delete" alt="Remove site" /></div>
    Last edited by lexington; 04-21-2011 at 06:30 PM.

Similar Threads

  1. Seeking Experienced Jquery/Jquery-UI Coder - Simple project
    By Dub in forum Employment / Job Offers
    Replies: 1
    Last Post: 06-30-2010, 08:20 AM
  2. Simple jQuery Superfish Menu - $50
    By ChainHost-Michael in forum Design Requests
    Replies: 3
    Last Post: 01-06-2010, 10:37 AM
  3. simple php code needing converted to asp code.
    By lochie in forum Programming Discussion
    Replies: 2
    Last Post: 08-30-2007, 04:33 AM
  4. Need PHP programmer to modify code
    By Centralized in forum Other Offers & Requests
    Replies: 0
    Last Post: 12-23-2002, 10:15 AM
  5. Good Code Red Article
    By in forum Web Hosting Lounge
    Replies: 0
    Last Post: 08-13-2001, 12:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts