jquery Novice Learning FAQ Solutions _jquery

Source: Internet
Author: User
Tags pack
Q0, novice must see the tutorial:

First step, jquery Chinese starter guide, translation plus example, jquery's starting point tutorial
The second step, the download manual convenient query (jQuery 1.41 Chinese API document CHM version)
The third step is to understand the difference between a jquery object and a normal DOM object. Convert each other to see Q1
q1,js: document.getElementById (' save '). Disabled=true;
That's what I wrote in jquery. $ ("#save"). Disabled = true; Why doesn't it work?

A, this is a typical problem, actually because the $ ("#save") is actually a jquery object, not a normal DOM object
This is a common problem for beginners.
There are 2 solutions:
1, with JQ, $ ("#save"). attr ("Disabled", "true");
2, turn into DOM writing $ ("#save") [0].disabled=true;
Of course, $ ("#save") [0] can also be written as $ ("#save"). Get (0). He's also returning DOM elements.

$ ("#save"). EQ (0) Gets or is the JQ object
$ (DOM object) to get a JQ object.

Q2, get the selected checkbox
A:
Get all the Checked checkbox:
$ ("input:checkbox:checked")
Determine if a set of checkbox is selected:
if ($ ("input:checkbox:checked"). Length) {}
Determine if a checkbox is selected
if ($ ("Input:checkbox"). Is (": Checked")) {}


Q3, I have a [] or a. Symbol in my id, what do I do? or XML tags with namespaces: What to do?
A: use \ \ To escape such as <div id= "id[1]" ></div>
$ ("#id \\[1\\]")

Q4, how to manipulate the object of a parent window in a frames page
A, the method of quoting UPC

I didn't find a good way.
We had to use the DOM method in conjunction with the JQuery method to implement the

1. Select all radio buttons in the iframe in the parent window
$ (window.frames["iframe1"].document). Find ("input[type= ' Radio ')"). attr ("Checked", "true");

2. Operation in iframe Select all radio buttons in the parent window
$ (window.parent.document). Find ("input[type= ' Radio ')"). attr ("Checked", "true");

IFrame frame: <iframe src= "test.html" id= "iframe1" width= "M" height= "" frameborder= "0" scrolling= "Auto" ></ Iframe>

IE7 test by going back you try it yourself.

The principle of implementation is actually very simple to use the $ (DOM object) can be converted into jquery objects
==================================================

But my method is.
Window.parent.jQuery ("input[name=validate]"). Val ("<%=session (" GetCode)%> ");
This section is from my blog automatically fill in the verification code, there is interest to analyze the framework of my footer.
In essence, the method of UPC is the same. We can learn from the reference

Q5, parsing xml loaded by Ajax, and related garbled problems
A: See the previous posts: hhttp://bbs.jquery.org.cn/read.php?tid-1673.html

Q6, I've got a plugin interface, how is it not easy to use in the latest jquery?
A:interface has been completely rewritten and renamed the jquery UI, where the latest version can be found:
http://ui.jquery.com/

Q7, in IE under the animation will flash, the effect is not ideal
A, plus a DTD definition
Like <!. DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

Q8, why did the official say
Download JQuery 1.2.3 ( 15kb, Minified and gzipped), but I was down there
Jquery-1.2.3.min.js 52.8 KB
A, apparently, he was using gzip (a server-side compression technology, Google himself). Not the official website write wrong not to update or is deceitful ~

What's the difference between Q9,pack,min and the original three versions?
Pack is used if the server does not turn on gzip
Min is the server has to open gzip when using
The original can be used in peacetime development, or their own analysis of the source code.

What compression software is used for q10,jquery?
A:dean Edwards wrote the Packer, which has now been converted to Tbcompressor(YUI compressor) compressed. Recommended to download a copy.
q11,$ (' a[@href ^= ' mailto] ') This code is not available in jquery 1.3, 1.2 can, why?
A:jquery 1.3 No longer need to use the @ symbol, simply remove the @ symbol to work properly.

can q12,jquery cross the field?
A:jquery itself is for JS encapsulation, browser to JS has permission settings, JS can not do, jquery can not do. But you can cross domains in a JSONP way.

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.