Re-understand the html () method in Jquery and jquery

Source: Internet
Author: User

Re-understand the html () method in Jquery and jquery

Today's test gave me a bug: on the page, I need to use "</td>" to get the cells after a column in a row in the table, that is, there is such a line of code: "tr = tr. substring (tr. indexOf ("</td>"); ", this JavaScript script can achieve the expected results in Google and other browsers, but it won't work in IE8, after more than an hour, I finally found the problem. Let's take a look at the following code:

<Html> This code can be displayed in the prompt box "Ideally" in Google's browser, but in IE8 we will find that all the labels in the prompt box are converted to uppercase, so "tr = tr. substring (tr. indexOf ("</td>"); "Of course it doesn't work. No way. The final solution is: tr = tr. indexOf ("</td>") =-1? Tr. substring (tr. indexOf ("</TD>"): tr. substring (tr. indexOf ("</td> "));

Note: In the above solution, tr is a variable. Heheh, I just pasted a part of the Code, which is in the $. each () array Traversal method.

Download resources at 0 Points]


For jquery html (val ),

I have not tried your methods. You can try it like this:
$ ('Tr: eq (I) '). find ('td: eq(0w.'hangzhou.html (I + 1); then you can

Using jQuery, css, and js in html

First, you need to know what css and jQuery (js) are.
Css is a style language for Web pages. It mainly describes its selector and attribute settings. Css can be directly written in html pages. It uses a style tag (<style> css Code </style>) and directly writes css code in the tag. We call this method an embedded style sheet. In addition, css can be directly written as attributes of other labels (<span style = "color: red;"> This is an inline style sheet </span> ), in this way, you can cancel the selector, but it is easy to repeat the code. The last is the external style sheet, which directly writes css in the css file, the link label is then used to introduce the <link type = "text/css" rel = "stylesheet" href = "css file address"/>.
Besides, JavaScript is called JavaScript. It is a Web Front-end programming language that can be used to control webpages. Js can also be directly written on the page. It uses the script tag, the script tag contains the js code (<script type = "text/javascript"> js code </script> ). In general, we write js in an external file, the external Association of js is also completed through the script tag (<script type = "text/javascript" src = "js file path"> </script> ).
Finally, jQuery is a lightweight js library. JQuery itself is also a js language. Therefore, its use fully inherits JavaScript, and its usage fully applies to jQuery. Js is actually a very troublesome language, and jQuery is to re-edit js, so that jQuery can be used more conveniently. In general, when jQuery is used, the native js language is rarely used.
To use jQuery, first download a jQuery js file (or copy the jQuery code to your own js file on the jQuery official website), and then on the page, use the script tag to introduce this js file to the page. JQuery can be used only when jQuery js files are introduced first.
So what about jQuery special effects? The so-called jQuery special effect is a js file written in the jQuery language. You can use some of these methods to introduce them to the page just like the js file that introduces jQuery. In addition, jQuery special effects may also contain css files and image files. Pay attention to the correct introduction of these files.

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.