JQuery Tutorial - Joshua Pelletier
JQuery Tutorial - Joshua Pelletier
JQuery Tutorial - Joshua Pelletier
ON
JQUERY]
1
Tutorial
on
jQuery
A
guide
to
getting
started
with
jQuery
Joshua Pelletier
IT704 2013
W
Whhaatt
iiss
JJQ
Quueerryy??
JQuery
is
a
JavaScript
library.
A
JavaScript
library,
like
JQuery,
takes
all
the
functions
of
regular
JavaScript
and
brings
them
together
in
a
simpler
way.
Doing
this
results
in
less
amount
of
code
needing
to
be
written
by
the
developer.
JQuery
is
entirely
free
to
download
and
it
is
an
open
source.
The
advantages
of
JQuery
being
an
open
source
are
that
anyone
can
add
any
type
of
plug-in
they
want.
It
also
allows
the
developer
to
use
the
code
in
anyway
they
see
fit
to
get
their
task
done.
First
thing
you
will
need
is
the
jQuery
library.
You
can
download
the
jQuery
library
directly
from
their
website
(http://jquery.com/download/).
They
have
a
number
of
versions
on
there.
It
is
up
to
you
which
version
you
use.
You
have
the
option
of
downloading
the
commpressed
or
the
uncompressed
verisons.
There
is
also
the
option
of
finding
a
CDN
(content
dilivery
system)
which
hosts
jQuery.
You
can
then
access
jQuery
through
that.
There
are
a
number
of
different
CDNs
that
host
jQuery.
Some
examples
are
Google
and
Microsoft
CDNs.
Some
sort
of
text
editor
to
be
able
to
create
HTML
and
JavaScript
documents
with.
Basic
knowledge
of
how
JavaScript
works.
However
it
is
not
required.
Use
this
site
to
help
you
get
the
basic
knowledge
of
jQuery(http://try.jquery.com/levels/1/challenges/1)
.
The
above
picture
was
taken
directly
from
the
jQuery
download
page
(http://jquery.com/download/).
JQuery
in
fact
has
its
own
CDN
where
you
can
access
the
versions
of
jQuery.
In
order
to
start
using
jQuery
you
will
need
to
insert
the
following
line
of
code
into
your
HTML
document
inside
of
the
<head>:
These lines of code will link your document with the jQuery CDN. There will
JQuery UI Plug-ins
A
plug-in
is
just
an
extension
of
the
already
existing
JQuery
code.
It
allows
for
more
features
that
web
developers
find
useful.
In
my
exploring
with
JQuery
I
found
that
all
the
cool
things
that
you
were
able
to
do
with
JQuery
were
in
fact
incorporated
through
plug-ins.
JQuery
also
has
a
vast
library
of
plug-ins.
Everyday
web
developers
in
fact
constructed
most
of
the
plug-ins
supported
by
JQuery.
Because
JQuery
is
open
source,
it
allows
people
to
submit
patches
and
to
create
plug-ins
for
other
developers
to
use.
There
is
literally
thousands
of
JQuery
plug-ins
and
most
of
them
can
be
found
here:
(http://plugins.jquery.com/).
You
incorporate
a
plug-in
the
same
way
you
would
incorporate
the
JQuery
library.
One
would
simply
put
it
inside
of
the
<script>
tag.
Like
so:
More
often
than
not
the
developer
must
also
include
some
more
coding
to
make
their
plug-ins
work.
For
my
example,
I
had
to
include
a
link
to
a
CSS
page
hosted
on
the
JQuery
CDN.
I
incorporated
the
CSS
page
like
this:
With
class
name
ui-widget-content
Without
class
name
ui-widget-content
The
JQuery
code
starts
with
opening
the
<script>
tag
and
then
calls
a
function
by
doing
$(function).
It
then
goes
inside
of
the
HTML,
looking
for
an
element
with
the
ID
of
accordion.
In
JQuery,
IDs
are
selected
using
the
#
and
classes
are
selected
using
a
..
Once
it
has
selected
the
right
element
it
calls
the
function
accordion,
which
is
a
built
in
plug-in
function.
The
accordion
function
extends
or
contracts
things
that
are
selected.
As
you
can
see
from
the
pictures
above,
when
a
section,
is
not
selected
it
is
contracted
down
so
you
cannot
see
its
content.
JQuery
then
goes
inside
of
the
HTML
document
and
gets
the
same
element
with
ID
of
accordion
and
calls
the
resizable
function
on
it.
The
resizable
function
allows
you
to
resize
the
tabs
so
that
you
can
display
their
entire
content.
As
you
can
see
from
the
picture,
section
3
has
more
content
that
cannot
be
displayed
because
of
the
size.
The
resizable
function
allows
you
to
resize
the
box
by
clicking
and
dragging
on
the
little
grey
arrow
in
the
bottom
right
corner
of
the
box
surrounding
the
tabs.
The
picture
shows
what
it
would
look
like
if
you
were
to
resize
the
tabs
so
that
all
of
its
content
could
be
displayed.
Code
examples
used
from
the
JQuery
UI
website:
http://jqueryui.com/accordion/
Conclusion
This
was
just
a
very
simple
example
of
how
you
can
use
JQuery
to
accomplish
some
tasks.
JQuery
can
be
used
to
do
far
more
complex
things
and
should
be.
This
tutorial
was
to
just
show
you
how
easy
it
is
to
incorporate
JQuery
into
your
HTML
and
how
simple
it
is
to
learn.
This
tutorial
also
was
meant
to
show
you
how
extensive
and
helpful
the
JQuery
plug-ins
can
be.
In
this
example,
both
of
the
functions
I
used
(accordion
and
resizable)
were
plug-ins.
Since
JQuery
is
the
largest
JavaScript
library
in
use
today
and
is
an
open
source,
it
only
means
that
it
is
always
evolving
and
expanding.
Resources
http://en.wikipedia.org/wiki/JQuery
http://jquery.com/download/
http://jqueryui.com/
http://try.jquery.com/levels/1/challenges/1
http://www.w3schools.com/jquery/default.asp