jquery gets a simple example of the SRC value of img _javascript tips

Source: Internet
Author: User

A simple remark, as follows:

The referenced jquery is as follows:

<script type= "Text/javascript" language= "JavaScript" src= "~/js/jquery-1.2.6.js" ></script>

<script type= "Text/javascript" language= "JavaScript" src= "~/js/jquery-1.2.6-vsdoc.js" ></script>

I use the following statement to make an error : (As for the reason I'm not sure, let me know if you have a clear problem)

1. Alert ($ (' #test '));

2. Alert ($ (' #test '). src);

After the "~" is removed, it is tantamount to removing the smart tip, after which the jquery reference is as follows:

<script type= "Text/javascript" language= "JavaScript" src= "/js/jquery-1.2.6.js" ></script>

<script type= "Text/javascript" language= "JavaScript" src= "/js/jquery-1.2.6-vsdoc.js" ></script>

Use $ (' #test '). The SRC statement does not error, but does not get an IMG address.

1. Alert ($ (' #test ')); Tip [Object].

2. Alert ($ (' #test '). src); Hint undefined.

Finally, use $ (' #test ') [0].SRC to Obtain an IMG address. (no in-depth studies have been carried out, but only the phenomenon is now known.) )

The above jquery get img The src value of a simple example is small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.