In order to understand more about
jQuery, there will be standard jQuery syntax
that you are going to learn more. jQuery syntax could be included as
tailor-made to select the elements of HTML and to perform some actions on that
elements. Thus, you will be able to select the HTML elements as well as perform
the action on them using jQuery. jQuery will also use CSS syntax in order to
select the elements. This section will give you the tutorial regarding jQuery
syntax which is given through step by step guide.
Here is Simple Tutorial for Standard jQuery Syntax
·
Apply document ready
event
To accomplish the purpose of
preventing any code of jQuery from running before document is ready or finished
loading, you can apply jQuery methods of document ready event. It will good
practice in waiting for documents to be firstly ready and loaded fully before
you are going to work with it. Document ready jQuery makes you able to get
JavaScript code as well before your document’s body, in head section. Some
actions might fail if the method is run before document is ready.
·
Use the event in jQuery
All actions of different visitors
that can be responded by the web page are known as events. Event jQuery represent precise moment of something
that happens. The example is selecting radio button, moving the mouse over the
element, or clicking on the element. There is common term which is used often
with events called fired/fires. When talking about jQuery field, DOM events
mostly have equivalent method of jQuery. You need to assign click event into
all paragraphs within a page. After that, you could define what thing that
should occur when an event fires by passing a function to that event.
In jQuery, there are also some
event methods which are commonly used. The method of click () can attach the
function of event handler to HTML element. The function will be executed when
users clicks on HTML element. The method of dblclick() also attaches the same
thing as click() method does, but with different function. It will execute the
function when users double-click on HTML element. There are more event methods
in jQuery including mouseenter(), mouseleave(), hover(), blur(), focus(), etc.
·
Declare jQuery
variable
In programming language, variable
is defined as value which can change. This depends on information that is
passed to a program or depends to condition. A program is typically consists of
some instructions which tell to computer about things to do. Meanwhile, the
data is defined as information used when a program is running. Data contains
fixed values or constants and variable values. Declaring variable of jQuery is
almost similar with JavaScript declaration. jQuery uses the symbol of $ to pass
function, selector, string, etc in order to implement or execute some
functionality.
The $ symbol which is used in
jQuery has the purpose to initialize the object. This symbol is related to variable declaration syntax of jQuery. You could
also replace the $ symbol by using jQuery word as well and the result given
will be same. It is basically a notation that you need to use for passing
selector.
0 komentar:
Posting Komentar