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 8882497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:35:40+00:00 2026-06-14T20:35:40+00:00

Here is the HTML: <html> <head> <script type=text/javascript src=jquery-1.7.2.min.js></script> <script type=text/javascript charset=utf-8 src=jquery-1.7.2.js></script> <script

  • 0

Here is the HTML:

<html>
  <head>
    <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="jquery-1.7.2.js"></script>
    <script type="text/javascript" src="access.js"></script>
  </head>
  <body>
    <button id="trigger"></button>
    <img id= "testElement" style= "position: absolute; border-color: white; top:340px; left:615px;" width="34px" height= "34px" />
  </body>
</html>

And the access.js file is:

$(document).ready( function(){
  $('#trigger').click(function(){
    $('#testElement').src="success.png";
    //THIS WON'T WORK.
    document.getElementById('testElement').src= "success.png";
    //BUT THIS WORKS.
  });
});

I know that if I use $, the return object is a jQuery object. It’s not the same as getElementById. But why the jQuery selector can’t work here?

I need the jQuery object to make more operations like “append/style”…

Thanks.

UPDATE
Too many correct answers appeared at almost the same time… Please give more explanation to let me decide who I should give the credit, thanks!

Sorry for my poor understanding of your correct answers… I just want more details.

Are all the attribute nodes (src/width/height…) not the property of jQuery object? So does the jQuery selector only select DOM Element Node like img/p/li/div node ? (<> causes some error.)

PLEASE TAKE A LOOK AT THE UPDATED INFORMATION…
Thank you!

  • 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-06-14T20:35:41+00:00Added an answer on June 14, 2026 at 8:35 pm

    A jQuery element is a DOM element wrapped in an array-like jQuery object so you have access to all the jQuery methods, but that means you “lose” access to the original DOM methods and properties. You can either use a jQuery method or grab the original DOM element to be able to use the vanilla properties.

    $('#testElement').attr('src', 'success.png');
    $('#testElement')[0].src = 'success.png';
                    --^-- get DOM element
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery Raty and I have the following script: <script type=text/javascript charset=utf-8 src={{
html embedded with javascript <html> <head> <title>Example</title> <script type =text/javascript> have I called this
Here is my code html> <head></head> <body> <?php $dir = 'folder/'; $files = scandir($dir);
Here's a sample gallery: <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd> <html> <head>
Here's my code for registerFormOne.php : <html> <head> <title>Registration Form - 1 of 2</title>
Here's the whole page: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> <html> <head>
I got this error after validation: document type does not allow element script here;
What is wrong with the following htmla and javascript code formToConvert.html <html> <head> <title>ExampleToConvert</title>
I have this two lines of html code... <div id=slider1 data-param1=XXX data-param2=XXX></div> <script src=script.js
Consider the following example: ( live demo here ) HTML: <div class=board> <div class=row>

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.