Selecting HTML elements with Id.
syntax:
$("#elementid")
The # selector selects an element with a unique id.
eg:
write the following in html head section
<script type="text/javascript">
$(
}
function DisplayAll() {"#divDetails").text("Welcome to my first jQuery application.");</script>
write the following in the body.
<div id="divDetails"></div><hr />
<div></div><hr /><div></div><hr /><div></div><hr />
Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts
Wednesday, September 29, 2010
jQuery Selectors: Select elements using Id
Tuesday, September 14, 2010
Using jQuery Selectors : Using tag name
Using jQuery Selectors
tag name, ID, and class. They can be used either on their own or in combination with other selectors.
Three building blocks of selectors are
Selecting HTML elements with tag name.
The following example demonstrates how to select all div elements and assign a text value into it within an HTML page.
syntax:
$(element name) : which returns all matched html elements.
$('element name').text('text to display'); : which assign the text value into all matched element.
Eg:
Add following in html head
<script type="text/javascript">
$(
}
function DisplayAll() {"div").text("Welcome to my first jQuery application.");</script>
Add following in html body
<input id="Button1" type="button" value="Display Text onclick="DisplayAll()" /><div></div><hr />
<div></div><hr /><div></div><hr /><div></div><hr />
tag name, ID, and class. They can be used either on their own or in combination with other selectors.
Three building blocks of selectors are
Selecting HTML elements with tag name.
The following example demonstrates how to select all div elements and assign a text value into it within an HTML page.
syntax:
$(element name) : which returns all matched html elements.
$('element name').text('text to display'); : which assign the text value into all matched element.
Eg:
Add following in html head
<script type="text/javascript">
$(
}
function DisplayAll() {"div").text("Welcome to my first jQuery application.");</script>
Add following in html body
<input id="Button1" type="button" value="Display Text onclick="DisplayAll()" /><div></div><hr />
<div></div><hr /><div></div><hr /><div></div><hr />
Introduction to jQuery & What jQuery does
Introduction to jQuery
jQuery is a library of JavaScript Functions, ie; a group of built-in javascript function to improve the interaction with web development.
Using jQuery you can do the following:
jQuery is a library of JavaScript Functions, ie; a group of built-in javascript function to improve the interaction with web development.
Using jQuery you can do the following:
- Simplify common JavaScript tasks
- Access HTML elements in a document
- HTML element manipulation
- Modify the appearance of a web page
- Manipulate CSS properties
- Alter the content of a document
- Respond to a user's interaction
- Animate changes being made to a document.
- Retrieve information from a server without refreshing a page ( AJAX).
- Link to download jQuery Libraray : http://docs.jquery.com/Downloading_jQuery
Subscribe to:
Posts (Atom)