Talking about jQuery, the
selectors of jQuery become one of important parts in jQuery library. Therefore,
this section will help you understand more of the tutorial of jQuery selectors,
especially for beginners. The selector allows you to manipulate and select the
elements of HTML. It can also be used to select or find HTML elements according
to their name, classes, id, types, attributes, attribute’s values, etc. There
is also jQuery ID selector which uses id
attribute of HTML tag in order to find specific element.
Important Points to Know Regarding jQuery ID Selector, CSS Selector, and
Others
Some of you may already know that
jQuery library uses CSS (Cascading Style Sheets) selector power to be able to
access the element or element group easily and quickly in DOM (Document Object
Model). In this case, the selector of jQuery is defined as the function that
uses expression to find matching element based on given criteria. jQuery
selector could also select all elements according to certain attribute. One of
the elements examples of attributes is href
attribute, title attribute, etc. To understand more about jQuery selector, you
may need this simple tutorial which involves some points to guide you.
·
Selector of element
name
In jQuery selector, you will be
familiar with element name selector. This selector is kind of jQuery select by name. It means that the selector
of element name will enable you for selecting element by the name. The name
itself refers to certain kind or type of elements. For the example, it could be
<p> elements or all <a> elements. The selector could also select
all a elements and change CSS style of that elements.
·
Selector of element
class name
If selecting elements using
typical approach of JavaScript might be painful, jQuery can even works like
magic. The powerful feature of jQuery includes making the selection of DOM
elements easy and simple. You can also get elements
by class name. Selecting the elements based on class name means that
class selector is able to be used for selecting specific class elements. For
instance, jQuery code highlights and selects the element that has class
attribute of class=”mark” once document is in ready state.
·
Selector of jQuery
CSS
In jQuery
CSS selector, selector is the pattern which is used for selecting elements
that you are going to style. The property is defined in different CSS version
whether it is CSS 3, CSS 2 or CSS 1. The selector can select elements with id,
with class, with target attribute, etc. It can also select input elements that
have focus, select link in mouse over, and so on.
·
Selector of elements
jQuery class
Elements jQuery
class selector is defined as the selector that can select the
elements with specific class. The word “class” itself refers to class attribute
in HTML element. Class attribute can be used for setting particular style of
some HTML elements. There is one point that you should know in which you must
not start class attribute using number. This is because it might cause some
problems in several browsers. The syntax is also being included in this
selector. The parameter is class which describes that it is required and
specifies element class to be selected.
0 komentar:
Posting Komentar