Today, when I was working on a job interview, David asked me to add a title: The difference between ID and name in HTML. A listen to Ah, the HTML ID and name what is the difference, but usually in use, not how to think, just so use it, oh, in fact, when doing the Web page there is a lot of things are just so used, and did not consider why so used ...One of the ot
Jquery searches for and operates on attribute values based on attributes and indexes. jquery attribute values
var assoeted =5;$(".zy_menu a[rel="+assoeted+"]").removeClass("hover_a").addClass("hover_a");$(".zy_menu a").removeClass("hover_a").eq(assoeted-1).addClass("hover_a");
How does
error. For example: $ ("#test"). InnerHTML, document.getElementById ("id").The syntax of HTML () is wrong.It is also important to note that the DOM object obtained by the JQuery object and document.getElementById ("id") with #id as the selector is not equivalent. See the conversion between the two below.Since
1. Error HINT: Your content must has a ListView whose id attribute is ' Android. R.id.list 'For the above error, it may be because we want to implement the Setonitemclick in the ListView of event monitoring to inherit the liseactivity, but there is no listview tag, as long as in the layout file to add custom layout code, When the ListView
things.
Of course the name attribute of the HTML element can also play a bit of ID on the page, because in the DHTML object Tree we can use Document.getelementsbyname to get an array of objects containing all the specified name elements in the page. Another problem with the Name property is that when we dynamically create an element that can contain the Name property, we cannot simply
drop-down menus
$ (": visible")
All visible elements
$ (": Submit")
All Submit button
14, Reverse Filter: $ ("tag: not (: a property)"): Selects any label that does not have a property.Filter out all tags that contain "one attribute" and leave other tags that do not have the attribute.For example: $ ("A:not (: Target)"), which means to select all a tags that do not write target.Tenth course Highlights (
Today did a waterfall flow layout of small example, in the process of writing the code has been reported cannot read property ' style ' of NULL, Baidu said after the page has not been loaded, But I read the code is written in the window.onload inside, but always error, find a half-day reason, only to find that they accidentally add classname to the id attribute,
Today in the development of Android small applications, the use of the ListView, in the use of their own style of the ListView, there is the error message such as the title, this let me wonder, not before this problem ah, but also can run, quickly check the information to find the reason, The original is my main activity inherited listactivity, and Listactivity must have a ListView, because Listactivity startup will default to look for this ListView ID
, execute JQ after loading ( to use JQ to write this sentence first, this is a fixed statement, the internal write is the JQ content )$ ("#btn"). Click (function () {//Find to ID selector btn, perform a click on it event, the event is declared with function, the content is:Alert ("AAAA"); Pop-up box showing AAAA});});* Equivalent to JS is to spread the whole thing into the HTML and JS to write, only use this time, JQ is similar to CSS set a selector,
To get an element from a property
1. For example, to get the element with ID in the page p tag
Copy Code code as follows:
$ ("P[id]"). CSS ("Color", "red");
Get an element from a property value
1.$. In jquery $ ("HTML code
Copy Code code as follows:
JQuery Code:
Cop
The following section describes how to assign values and obtain attributes of the Jqueryattr () method. I think this is quite good. Now I will share it with you and give you a reference to using the attr () method in jquery to obtain and set element attributes. attr is the abbreviation of attribute, attr () is often used in jQuery DOM operations. attr () has four
Attribute selector, jquery attribute Selector
The attribute selector can select an element based on its attributes and attribute values.In CSS3, three attribute selectors are added to enable the
For example, because a commodity table and an Attribute Table have many-to-many relationships, a commodity attribute intermediate table exists. CREATETABLEIFNOTEXISTSdslxs_goods_attr (goods_idmediumint (8) unsignedNOTNULLCOMMENT #039; item id #039;, attr_idmediumint (8) unsigne... for example, because a commodity table and an
JQuery removes the img element of the specified id from the div with the specified id, jquerydiv
During project creation, I dynamically Add the img element to the div with the specified id through jQuery, and then click the delet
elements whose href values end with ". jpg.
JQuery CSS Selector
The jQuery CSS selector can be used to change the CSS attributes of HTML elements.The following example changes the background color of all p elements to Red:
Instance
$ ("P" ).css ("background-color", "red ");
More select instances
Syntax
Description
$ (This)
Current HTML Element
$ ("P ")
All
Jquery has been used in recent projects. In the process of doing so, I took a lot of detours and kept searching. I have summarized some jquery selectors and attribute setting usage for your reference. I am a newbie. I have never used jquery before. I recently used jquery in
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.