1. Passing parameters using single quotes: Test1
If one of the parameters contains single quotes, this method will fail. Test1
Improvement: \ 'and OK are added with single quotes. Test
2. The problem of single quotes is solved above, but if
ZTree plug-in Multi-choice drop-down menu instance codeCss and jsCopy codeThe Code is as follows:
HtmlCopy codeThe Code is as follows:
OK Custom js CodeCopy codeThe Code is as follows:
There are two scenarios:1. If css is written as an in-row style, you can determine it by obtaining the value of the style attribute, for example:Determine whether the div element with id divid has a font-size style:Copy codeThe Code is as follows:
I recently reviewed some of my previous basic knowledge and wrote an image slide plug-in using jquery. Although there are still some problems, it is easy to use. You only need to bind the slideW () function to the target element, this function
A navigation bar consists of a group of Horizontally arranged links, which are usually included in the header or tail.
By default, links in the navigation bar are automatically converted to buttons (data-role = "button" is not required ").
Use the
GetBoundingClientRect () to get the position of the page ElementCopy codeThe Code is as follows:Document.doc umentElement. getBoundingClientRect This method returns an object to obtain the position of an element on the left, top, right, and bottom
Removing spaces at both ends of a string is a very common method for string processing. Unfortunately, JavaScript does not have these three methods, which are only customized:Step 2: Add a member to StringCopy codeThe Code is as follows:String.
Js has some restrictions on modifying the type attribute of input. You can modify the value of the input element before inserting the document stream. It is normal in ie and ff. However, if the input already exists on the page, its type attribute
First: Compared with the traditional sorting, this is a good attempt and I hope to inspire everyone.You can refer to my previous blog: http://www.jb51.net/article/42087.htmHtml section:Copy codeThe Code is as follows: metrics: Note: you can drag
I have never paid attention to the property of div's background-image before, but set its url. Today I have encountered a problem and I would like to record it.Copy codeThe Code is as follows: Get image attributes in jsCopy codeThe Code is as
Suppose we need a scenario like this: there is a checkbox on the page, and we expect to use Jquery to determine whether it is selected, or use Jquery to make it selected.In versions earlier than JQ1.6, We will write our Code as follows:Copy codeThe
Queue ()/dequeue ()These two methods are just as concealed as the XMLHttpRequest object of Ajax and are not known to anyone. These two methods are very useful in animation processing. We often write such code.
Copy codeThe Code is as follows:$ ('#
For (var I = 0; I For example:Copy codeThe Code is as follows:Var a = ["a", "B", "c"];For (var el in ){Alert (a [el]);} This is to cite all the elements in a. Of course, the above example can be used.Copy codeThe Code is as follows:For (var I = 0,
Control by number of characters:Copy codeThe Code is as follows:Onkeyup = "if (this. value. length> 2000) this. value = this. value. substr )"Onkeydown = "if (this. value. length> 2000) this. value = this. value. substr )"Onblur = "if (this. value.
Use substring () or slice ()
Function: split ()Function: uses a specified separator to split a string and store it in an array.Example:Copy codeThe Code is as follows:Str = "jpg | bmp | gif | ico | png ";Arr = theString. split ("| ");// Arr is an
I went to the interview the day before yesterday. gg asked some js knowledge, including a call and apply usage question. Although I used the call method 365 days ago, I still couldn't answer it, summary today
Call and apply. They are used to bind a
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