Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4627270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:32:38+00:00 2026-05-22T03:32:38+00:00

I’ve got a bit of a problem with a very simple JQuery bit of

  • 0

I’ve got a bit of a problem with a very simple JQuery bit of JQuery code – I’ve been troubleshooting it by:

  1. Moving the JQuery code to the end of the document
  2. Using google hosted JQuery and local hosted
  3. Using the $(document).ready – and without
  4. Simplifying it by taking out the PHP generated code, inserting it in a HTML document and trying it without the PHP
  5. Inserting the code with firebug – note: This actually works perfectly

Here’s the JQuery code:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script language="text/javascript">
$(document).ready( function(){
    $('.del').click(function() {
        alert(this.id);
    });
});
</script>

Here’s the PHP code:

    while($row = mysql_fetch_array($reports)){
        echo '<tr><th>'.$row['title'].'</th>';
        echo '<td><a href="modify.php?site='.$row['id'].'">Modify</a></td>';
        echo '<td> <img class="del" id="'.$row['id'].'" src="../right_place.jpg" width="75" height="75"></td>';
        echo '<td><a href="../report.php?site='.$row['id'].'"><img src="../'.$row['thumb'].'" width="75" height="75"></a></td></tr>';
    }

Which generates this kind HTML:

            <tr>
                <th>Site 2</th>
                <td><a href="modify.php?site=2">Modify</a></td>
                <td><img class="del" id="2" src="../right_place.jpg" width="75" height="75"></td>
                <td><a href="../report.php?site=2"><img src="../placeholder.jpg" width="75" height="75"></a></td>
            </tr>

            <tr>
                <th>Site 1</th>
                <td><a href="modify.php?site=1">Modify</a></td>
                <td><img class="del" id="1" src="../right_place.jpg" width="75" height="75"></td>
                <td><a href="../report.php?site=1"><img src="../placeholder.jpg" width="75" height="75"></a></td>
            </tr>

I’ve currently tried it in Google Chrome and Internet Explorer. The most interesting aspect of this is that if I copy and paste the JQuery code in to firebug, it executes perfectly and there are no errors?! However when it is in the page it will not execute. (Hence one reason I tried putting the code at the bottom of the page!)

Note: The JQuery code is also simplified for debugging/testing purposes – in reality it will prompt the user for confirmation before making an AJAX call to a PHP script that performs a MySQL query.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:32:39+00:00Added an answer on May 22, 2026 at 3:32 am

    Couple of things wrong here.

    1). Don’t use numeric IDs. IDs must begin with a letter.

    2). Your script tag is incorrect, using a language specifier instead of type specifier. It should read:

    <script type="text/javascript">
    

    Fix that and it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have a jquery bug and I've been looking for hours now, I can't
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.