INFO 69998 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO 69998 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 69998 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
INFO 69998 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
INFO 69998 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1185 ms
INFO 69998 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
INFO 69998 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
INFO 69998 --- [main] c.e.demo.ContactManagerApplication : Started ContactManagerApplication in 2.457 seconds (JVM running for 3.521)
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
$(document).ready(function() { printCurrentDatetime(); });
function printCurrentDatetime() {
let date = new Date();
$('#currentTime').html(date);
setTimeout(printCurrentDatetime, 1000);
}
@Getter
@Setter
@JsonInclude(Include.NON_NULL)
public class MyJsonDataWrapperClass {
private Integer someIntData;
private List<MyJsonData> myJsonData = new ArrayList<>();
@Override
public String toString() {
return new Gson().toJson(this);
}
}
@Getter
@Setter
@EqualsAndHashCode
public class MyJsonData {
private String name;
private int age;
@Override
public String toString() {
return new Gson().toJson(this);
}
}
jQuery provides a trivially simple interface for doing various kind
of amazing effects. jQuery methods allow us to quickly apply commonly
used effects with a minimum configuration.
This tutorial covers all the important jQuery methods to create visual effects.
์์ ์จ๊ธฐ๊ธฐ์ ๋ณด์ด๊ธฐ
The commands for showing and hiding elements are pretty much what we would expect: show() to show the elements in a wrapped set and hide() to hide them.
๋ฌธ๋ฒ:
Here is the simple syntax for show() method:
[selector].show( speed, [callback] );
Here is the description of all the parameters:
speed: A string representing one of the three predefined
speeds ("slow", "normal", or "fast") or the number of milliseconds to
run the animation (e.g. 1000).
callback: This optional parameter represents a function
to be executed whenever the animation completes; executes once for each
element animated against.
Following is the simple syntax for hide() method:
[selector].hide( speed, [callback] );
Here is the description of all the parameters:
speed: A string representing one of the three predefined
speeds ("slow", "normal", or "fast") or the number of milliseconds to
run the animation (e.g. 1000).
callback: This optional parameter represents a function
to be executed whenever the animation completes; executes once for each
element animated against.
์์ :
Consider the following HTML file with a small JQuery coding:
jQuery provides methods to toggle the display state of elements
between revealed or hidden. If the element is initially displayed, it
will be hidden; if hidden, it will be shown.
๋ฌธ๋ฒ:
Here is the simple syntax for one of the toggle() methods:
[selector]..toggle([speed][, callback]);
Here is the description of all the parameters:
speed: A string representing one of the three predefined
speeds ("slow", "normal", or "fast") or the number of milliseconds to
run the animation (e.g. 1000).
callback: This optional parameter represents a function
to be executed whenever the animation completes; executes once for each
element animated against.
์์ :
We can animate any element, such as a simple <div> containing an image:
fadeIn( speed, [callback] ) Fade in all matched elements by adjusting their opacity and firing an optional callback after completion.
fadeOut( speed, [callback] ) Fade
out all matched elements by adjusting their opacity to 0, then setting
display to "none" and firing an optional callback after completion.
fadeTo( speed, opacity, callback ) Fade the opacity of all matched elements to a specified opacity and firing an optional callback after completion.
hide( ) Hides each of the set of matched elements if they are shown.
hide( speed, [callback] ) Hide all matched elements using a graceful animation and firing an optional callback after completion.
show( ) Displays each of the set of matched elements if they are hidden.
show( speed, [callback] ) Show all matched elements using a graceful animation and firing an optional callback after completion.
slideDown( speed, [callback] ) Reveal all matched elements by adjusting their height and firing an optional callback after completion.
slideToggle( speed, [callback] ) Toggle the visibility of all matched elements by adjusting their height and firing an optional callback after completion.
slideUp( speed, [callback] ) Hide all matched elements by adjusting their height and firing an optional callback after completion.
toggle( ) Toggle displaying each of the set of matched elements.
toggle( speed, [callback] ) Toggle
displaying each of the set of matched elements using a graceful
animation and firing an optional callback after completion.
toggle( switch ) Toggle displaying each of the set of matched elements based upon the switch (true shows all elements, false hides all elements).
To use these effects you would have to download jQuery UI Library jquery-ui-1.7.2.custom.min.js or latest version of this UI library from jQuery UI Library.
After extracting jquery-ui-1.7.2.custom.min.js file from the
download, you would include this file in similar way as you include core
jQuery Library file.
Methods and Description
Blind Blinds the element away or shows it by blinding it in.
Bounce Bounces the element vertically or horizontally n-times.
Clip Clips the element on or off, vertically or horizontally.
Drop Drops the element away or shows it by dropping it in.
Explode Explodes the element into multiple pieces.
AJAX is an acronym standing for Asynchronous JavaScript and XML and
this technology help us to load data from the server without a browser
page refresh.
If you are new with AJAX, I would recommend you go through our Ajax Tutorial before proceeding further.
JQuery is a great tool which provides a rich set of AJAX methods to develope next generation web application.
๋ฐ์ดํ ๋ก๋ฉํ๊ธฐ
This is very easy to load any static or dynamic data using JQuery AJAX. JQuery provides load() method to do the job:
๋ฌธ๋ฒ:
Here is the simple syntax for load() method:
[selector].load( URL, [data], [callback] );
Here is the description of all the parameters:
URL: The URL of the server-side resource to which the
request is sent. It could be a CGI, ASP, JSP, or PHP script which
generates data dynamically or out of a database.
data: This optional parameter represents an object whose
properties are serialized into properly encoded parameters to be passed
to the request. If specified, the request is made using the POST method. If omitted, the GET method is used.
callback: A callback function invoked after the response
data has been loaded into the elements of the matched set. The first
parameter passed to this function is the response text recieved from the
server and second parameter is the status code.
์์ :
Consider the following HTML file with a small JQuery coding:
Here load() initiates an Ajax request to the specified URL /jquery/result.html file. After loading this file, all the content would be populated inside <div> tagged with ID stage. Assuming, our /jquery/result.html file has just one HTML line:
<h1>THIS IS RESULT...</h1>
When you click the given button, then result.html file gets loaded.
JSON ๋ฐ์ดํ ์ฝ์ด์ค๊ธฐ
There would be a situation when server would return JSON string against your request. JQuery utility function getJSON()
parses the returned JSON string and makes the resulting string
available to the callback function as first parameter to take further
action.
๋ฌธ๋ฒ:
Here is the simple syntax for getJSON() method:
[selector].getJSON( URL, [data], [callback] );
Here is the description of all the parameters:
URL: The URL of the server-side resource contacted via the GET method.
data: An object whose properties serve as the name/value
pairs used to construct a query string to be appended to the URL, or a
preformatted and encoded query string.
callback: A function invoked when the request completes.
The data value resulting from digesting the response body as a JSON
string is passed as the first parameter to this callback, and the status
as the second.
์์ :
Consider the following HTML file with a small JQuery coding:
Here JQuery utility method getJSON() initiates an Ajax request to the specified URL /jquery/result.json
file. After loading this file, all the content would be passed to the
callback function which finally would be populated inside <div>
tagged with ID stage. Assuming, our /jquery/result.json file has following json formatted content:
When you click the given button, then result.json file gets loaded.
์๋ฒ๋ก ๋ฐ์ดํ ์ ๋ฌํ๊ธฐ
Many times you collect input from the user and you pass that input to
the server for further processing. JQuery AJAX made it easy enough to
pass collected data to the server using data parameter of any available Ajax method.
์์ :
This example demonstrate how can pass user input to a web server
script which would send the same result back and we would print it:
<html>
<head>
<title>the title</title>
<script type="text/javascript"
src="/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#driver").click(function(event){
var name = $("#name").val();
$("#stage").load('/jquery/result.php', {"name":name} );
});
});
</script>
</head>
<body>
<p>Enter your name and click on the button:</p>
<input type="input" id="name" size="40" /><br />
<div id="stage" style="background-color:blue;">
STAGE
</div>
<input type="button" id="driver" value="Show Result" />
</body>
</html>
We have the ability to create dynamic web pages by using events.
Events are actions that can be detected by your Web Application.
Following are the examples events:
A mouse click
A web page loading
Taking mouse over an element
Submitting an HTML form
A keystroke on your keyboard
etc.
When these events are triggered you can then use a custom function to
do pretty much whatever you want with the event. These custom functions
call Event Handlers.
์ด๋ฒคํธ ํธ๋ค๋ฌ ๋ฐ์ธ๋ฉํ๊ธฐ
Using the jQuery Event Model, we can establish event handlers on DOM elements with the bind() method as follows:
This code will cause the division element to respond to the click
event; when a user clicks inside this division thereafter, the alert
will be shown.
The full syntax of the bind() command is as follows:
selector.bind( eventType[, eventData], handler)
Following is the description of the parameters:
eventType: A string containing a JavaScript event type,
such as click or submit. Refer to the next section for a complete list
of event types.
eventData: This is optional parameter is a map of data that will be passed to the event handler.
handler: A function to execute each time the event is triggered.
์ด๋ฒคํธ ํธ๋ค๋ฌ ์ญ์ ํ๊ธฐ
Typically, once an event handler is established, it remains in effect
for the remainder of the life of the page. There may be a need when you
would like to remove event handler.
jQuery provides the unbind() command to remove an exiting event handler. The syntax of unbind() is as follows:
selector.unbind(eventType, handler)
or
selector.unbind(eventType)
Following is the description of the parameters:
eventType: A string containing a JavaScript event type,
such as click or submit. Refer to the next section for a complete list
of event types.
handler: If provided, identifies the specific listener that has to be removed.
์ด๋ฒคํธ ํ์
The following are cross platform and recommended event types which you can bind using JQuery:
Event Type
Description
blur
Occurs when the element loses focus
change
Occurs when the element changes
click
Occurs when a mouse click
dblclick
Occurs when a mouse double-click
error
Occurs when there is an error in loading or unloading etc.
focus
Occurs when the element gets focus
keydown
Occurs when key is pressed
keypress
Occurs when key is pressed and released
keyup
Occurs when key is released
load
Occurs when document is loaded
mousedown
Occurs when mouse button is pressed
mouseenter
Occurs when mouse enters in an element region
mouseleave
Occurs when mouse leaves an element region
mousemove
Occurs when mouse pointer moves
mouseout
Occurs when mouse pointer moves out of an element
mouseover
Occurs when mouse pointer moves over an element
mouseup
Occurs when mouse button is released
resize
Occurs when window is resized
scroll
Occurs when window is scrolled
select
Occurs when a text is selected
submit
Occurs when form is submitted
unload
Occurs when documents is unloaded
์ด๋ฒคํธ ๊ฐ์ฒด
The callback function takes a single parameter; when the handler is
called the JavaScript event object will be passed through it.
The event object is often unneccessary and the parameter is omitted,
as sufficient context is usually available when the handler is bound to
know exactly what needs to be done when the handler is triggered,
however there are certail attributes which you would need to be
accessed.
์ด๋ฒคํธ ์์ฑ
The following event properties/attributes are available and safe to access in a platform independent manner:
Property
Description
altKey
Set to true if the Alt key was pressed when the
event was triggered, false if not. The Alt key is labeled Option on most
Mac keyboards.
ctrlKey
Set to true if the Ctrl key was pressed when the event was triggered, false if not.
data
The value, if any, passed as the second parameter to the bind() command when the handler was established.
keyCode
For keyup and keydown events, this returns the key that was pressed.
metaKey
Set to true if the Meta key was pressed when the
event was triggered, false if not. The Meta key is the Ctrl key on PCs
and the Command key on Macs.
pageX
For mouse events, specifies the horizontal coordinate of the event relative from the page origin.
pageY
For mouse events, specifies the vertical coordinate of the event relative from the page origin.
relatedTarget
For some mouse events, identifies the element that the cursor left or entered when the event was triggered.
screenX
For mouse events, specifies the horizontal coordinate of the event relative from the screen origin.
screenY
For mouse events, specifies the vertical coordinate of the event relative from the screen origin.
shiftKey
Set to true if the Shift key was pressed when the event was triggered, false if not.
target
Identifies the element for which the event was triggered.
timeStamp
The timestamp (in milliseconds) when the event was created.
type
For all events, specifies the type of event that was triggered (for example, click).
which
For keyboard events, specifies the numeric code
for the key that caused the event, and for mouse events, specifies which
button was pressed (1 for left, 2 for middle, 3 for right)
์ด๋ฒคํธ ๊ฐ์ฒด์ ๋ฉ์๋
There is a list of methods which can be called on an Event Object:
JQuery provides methods to manipulate DOM in efficient way. You do
not need to write big code to modify the value of any element's
attribute or to extract HTML code from a paragraph or division.
JQuery provides methods such as .attr(), .html(), and .val() which
act as getters, retrieving information from DOM elements for later use.
์ปจํ ์ธ ์กฐ์:
The html( ) method gets the html contents (innerHTML) of the first matched element.
Here is the syntax for the method:
selector.html( )
์์ :
Following is an example which makes use of .html() and .text(val)
methods. Here .html() retrieves HTML content from the object and then
.text( val ) method sets value of the object using passed parameter:
<html>
<head>
<title>the title</title>
<script type="text/javascript"
src="/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("div").click(function () {
var content = $(this).html();
$("#result").text( content );
});
});
</script>
<style>
#division{ margin:10px;padding:12px;
border:2px solid #666;
width:60px;
}
</style>
</head>
<body>
<p>Click on the square below:</p>
<span id="result"> </span>
<div id="division" style="background-color:blue;">
This is Blue Square!!
</div>
</body>
</html>
DOM ์์ ๋ณ๊ฒฝ
You can replace a complete DOM element with the specified HTML or DOM elements. The replaceWith( content ) method serves this purpose very well.
Here is the syntax for the method:
selector.replaceWith( content )
Here content is what you want to have instead of original element. This could be HTML or simple text.
์์ :
Following is an example which would replace division element with "<h1>JQuery is Great</h1>":
<html>
<head>
<title>the title</title>
<script type="text/javascript"
src="/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("div").click(function () {
$(this).replaceWith("<h1>JQuery is Great</h1>");
});
});
</script>
<style>
#division{ margin:10px;padding:12px;
border:2px solid #666;
width:60px;
}
</style>
</head>
<body>
<p>Click on the square below:</p>
<span id="result"> </span>
<div id="division" style="background-color:blue;">
This is Blue Square!!
</div>
</body>
</html>
DOM ์์ ์ญ์
There may be a situation when you would like to remove one or more
DOM elements from the document. JQuery provides two methods to handle
the situation.
The empty( ) method remove all child nodes from the set of matched elements where as the method remove( expr ) method removes all matched elements from the DOM.
Here is the syntax for the method:
selector.remove( [ expr ])
or
selector.empty( )
You can pass optional paramter expr to filter the set of elements to be removed.
์์ :
Following is an example where elements are being removed as soon as they are clicked:
There may be a situation when you would like to insert new one or
more DOM elements in your existing document. JQuery provides various
methods to insert elements at various locations.
The after( content ) method insert content after each of the matched elements where as the method before( content ) method inserts content before each of the matched elements.
Here is the syntax for the method:
selector.after( content )
or
selector.before( content )
Here content is what you want to insert. This could be HTML or simple text.
์์ :
Following is an example where <div> elements are being inserted just before the clicked element:
The jQuery library supports nearly all of the selectors included in
Cascading Style Sheet (CSS) specifications 1 through 3, as outlined on
the World Wide Web Consortium's site.
Using JQuery library developers can enhance their websites without
worrying about browsers and their versions as long as the browsers have
JavaScript enabled.
Most of the JQuery CSS Methods do not modify the content of the
jQuery object and they are used to apply CSS properties on DOM elements.
CSS ์์ฑ ์ ์ฉํ๊ธฐ
This is very simple to apply any CSS property using JQuery method css( PropertyName, PropertyValue ).
Here is the syntax for the method:
selector.css( PropertyName, PropertyValue );
Here you can pass PropertyName as a javascript string and based on its value, PropertyValue could be string or integer.
์์ :
Following is an example which adds font color to the second list item.
You can apply multiple CSS properties using a single JQuery method CSS( {key1:val1, key2:val2....). You can apply as many properties as you like in a single call.
jQuery is a very powerful tool which provides a variety of DOM
traversal methods to help us select elements in a document randomly as
well as in sequential method.
Most of the DOM Traversal Methods do not modify the jQuery object and
they are used to filter out elements from a document based on given
conditions.
์ธ๋ฑ์ค๋ฅผ ์ด์ฉํ ๋ ์์ ์ฐพ๊ธฐ
Consider a simple document with the following HTML content:
The filter( selector ) method can be used to filter out all
elements from the set of matched elements that do not match the
specified selector(s). The selector can be written using any selector syntax.
์์ :
Following is a simple example which applies color to the lists associated with middle class:
The find( selector ) method can be used to locate all the descendent elements of a particular type of elements. The selector can be written using any selector syntax.
์์ :
Following is an example which selects all the <span> elements available inside different <p> elements:
<html>
<head>
<title>the title</title>
<script type="text/javascript"
src="/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("p").find("span").addClass("selected");
});
</script>
<style>
.selected { color:red; }
</style>
</head>
<body>
<p>This is 1st paragraph and <span>THIS IS RED</span></p>
<p>This is 2nd paragraph and <span>THIS IS ALSO RED</span></p>
</body>
</html>
์ ์ฉํ JQuery DOM Traversing ๋ฉ์๋
Following table lists down useful methods which you can use to filter out various elements from a list of DOM elements:
Some of the most basic components we can manipulate when it comes to
DOM elements are the properties and attributes assigned to those
elements.
Most of these attributes are available through JavaScript as DOM node properties. Some of the more common properties are:
className
tagName
id
href
title
rel
src
Consider the following HTML markup for an image element:
<img id="myImage" src="image.gif" alt="An image"
class="someClass" title="This is an image"/>
In this element's markup, the tag name is img, and the markup for id,
src, alt, class, and title represents the element's attributes, each of
which consists of a name and a value.
jQuery gives us the means to easily manipulate an element's
attributes and gives us access to the element so that we can also change
its properties.
Set
the value attribute of every matched element if it is called on
<input> but if it is called on <select> with the passed
<option> value then passed option would be selected, if it is
called on check box or radio box then all the matching check box and
radiobox would be checked.
Similar to above syntax and examples, following examples would give
you understanding on using various attribute methods in different
situation:
$("#myID").attr("custom") : This would return value of attribute custom for the first element matching with ID myID.
$("img").attr("alt", "Sample Image"): This sets the alt attribute of all the images to a new value "Sample Image".
$("input").attr({ value: "", title: "Please enter a value" }); : Sets the value of all <input> elements to the empty string, as well as sets the title to the string Please enter a value.
$("a[href^=http://]").attr("target","_blank"): Selects all links with an href attribute starting with http:// and set its target attribute to _blank
$("a").removeAttr("target") : This would remove target attribute of all the links.
$("form").submit(function() {$(":submit",this).attr("disabled", "disabled");}); : This would modify the disabled attribute to the value "disabled" while clicking Submit button.
$("p:last").hasClass("selected"): This return true if last <p> tag has associated classselected.
$("p").text(): Returns string that contains the combined text contents of all matched <p> elements.
$("p").text("<i>Hello World</i>"): This would set "<I>Hello World</I>" as text content of the matching <p> elements
$("p").html() : This returns the HTML content of the all matching paragraphs.
$("div").html("Hello World") : This would set the HTML content of all matching <div> to Hello World.
$("input:checkbox:checked").val() : Get the first value from a checked checkbox
$("input:radio[name=bar]:checked").val(): Get the first value from a set of radio buttons
$("button").val("Hello") : Sets the value attribute of every matched element <button>.
$("input").val("on") : This would check all the radio or check box button whose value is "on".
$("select").val("Orange") : This would select Orange option in a dropdown box with options Orange, Mango and Banana.
$("select").val("Orange", "Mango") : This would select Orange and Mango options in a dropdown box with options Orange, Mango and Banana.
The jQuery library harnesses the power of Cascading Style Sheets
(CSS) selectors to let us quickly and easily access elements or groups
of elements in the Document Object Model (DOM).
A jQuery Selector is a function which makes use of expressions to
find out matching elements from a DOM based on the given criteria.
$() factory function (ํฉํ ๋ฆฌ ํจ์):
All type of selectors available in jQuery, always start with the dollar sign and parentheses: $().
The factory function $() makes use of following three building blocks while selecting elements in a given document:
jQuery
Description
Tag Name:
Represents a tag name available in the DOM. For example $('p') selects all paragraphs in the document.
Tag ID:
Represents a tag available with the given ID in the DOM. For example $('#some-id') selects the single element in the document that has an ID of some-id.
Tag Class:
Represents a tag available with the given class in the DOM. For example $('.some-class') selects all elements in the document that have a class of some-class.
All the above items can be used either on their own or in combination
with other selectors. All the jQuery selectors are based on the same
principle except some tweaking.
NOTE: The factory function $() is a synonym of jQuery() function. So in case you are using any other JavaScript library where $ sign is conflicting with some thing else then you can replace $ sign by jQuery name and you can use function jQuery() instead of $().
Example(์์ ):
Following is a simple example which makes use of Tag Selector. This would select all the elements with a tag name p.
<html>
<head>
<title>the title</title>
<script type="text/javascript"
src="/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
var pars = $("p");
for( i=0; i<pars.length; i++ ){
alert("Found paragraph: " + pars[i].innerHTML);
}
});
</script>
</head>
<body>
<div>
<p class="myclass">This is a paragraph.</p>
<p id="myid">This is second paragraph.</p>
<p>This is third paragraph.</p>
</div>
</body>
</html>
$('*'): This selector selects all elements in the document.
$("p > *"): This selector selects all elements that are children of a paragraph element.
$("#specialID"): This selector function gets the element with id="specialID".
$(".specialClass"): This selector gets all the elements that have the class of specialClass.
$("li:not(.myclass)"): Selects all elements matched by <li> that do not have class="myclass".
$("a#specialID.specialClass"): This selector matches links with an id of specialID and a class of specialClass.
$("p a.specialClass"): This selector matches links with a class of specialClass declared within <p> elements.
$("ul li:first"): This selector gets only the first <li> element of the <ul>.
$("#container p"): Selects all elements matched by <p> that are descendants of an element that has an id of container.
$("li > ul"): Selects all elements matched by <ul> that are children of an element matched by <li>
$("strong + em"): Selects all elements matched by <em> that immediately follow a sibling element matched by <strong>.
$("p ~ ul"): Selects all elements matched by <ul> that follow a sibling element matched by <p>.
$("code, em, strong"): Selects all elements matched by <code> or <em> or <strong>.
$("p strong, .myclass"): Selects all elements matched by
<strong> that are descendants of an element matched by <p>
as well as all elements that have a class of myclass.
$(":empty"): Selects all elements that have no children.
$("p:empty"): Selects all elements matched by <p> that have no children.
$("div[p]"): Selects all elements matched by <div> that contain an element matched by <p>.
$("p[.myclass]"): Selects all elements matched by <p> that contain an element with a class of myclass.
$("a[@rel]"): Selects all elements matched by <a> that have a rel attribute.
$("input[@name=myname]"): Selects all elements matched by <input> that have a name value exactly equal to myname.
$("input[@name^=myname]"): Selects all elements matched by <input> that have a name value beginning with myname.
$("a[@rel$=self]"): Selects all elements matched by <a> that have rel attribute value ending with self
$("a[@href*=domain.com]"): Selects all elements matched by <a> that have an href value containing domain.com.
$("li:even"): Selects all elements matched by <li> that have an even index value.
$("tr:odd"): Selects all elements matched by <tr> that have an odd index value.
$("li:first"): Selects the first <li> element.
$("li:last"): Selects the last <li> element.
$("li:visible"): Selects all elements matched by <li> that are visible.
$("li:hidden"): Selects all elements matched by <li> that are hidden.
$(":radio"): Selects all radio buttons in the form.
$(":checked"): Selects all checked boxex in the form.
$(":input"): Selects only form elements (input, select, textarea, button).
$(":text"): Selects only text elements (input[type=text]).
$("li:eq(2)"): Selects the third <li> element
$("li:eq(4)"): Selects the fifth <li> element
$("li:lt(2)"): Selects all elements matched by <li> element before the third one; in other words, the first two <li> elements.
$("p:lt(3)"): selects all elements matched by <p> elements before the fourth one; in other words the first three <p> elements.
$("li:gt(1)"): Selects all elements matched by <li> after the second one.
$("p:gt(2)"): Selects all elements matched by <p> after the third one.
$("div/p"): Selects all elements matched by <p> that are children of an element matched by <div>.
$("div//code"): Selects all elements matched by <code>that are descendants of an element matched by <div>.
$("//p//a"): Selects all elements matched by <a> that are descendants of an element matched by <p>
$("li:first-child"): Selects all elements matched by <li> that are the first child of their parent.
$("li:last-child"): Selects all elements matched by <li> that are the last child of their parent.
$(":parent"): Selects all elements that are the parent of another element, including text.
$("li:contains(second)"): Selects all elements matched by <li> that contain the text second.
<% response.expires=-1 sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID=" sql=sql & "'" & request.querystring("q") & "'"
set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("/datafolder/northwind.mdb")) set rs=Server.CreateObject("ADODB.recordset") rs.Open sql,conn
response.write("<table>") do until rs.EOF for each x in rs.Fields response.write("<tr><td><b>" & x.name & "</b></td>") response.write("<td>" & x.value & "</td></tr>") next rs.MoveNext loop response.write("</table>") %>