How do I select something that ends with a certain text using jQuery?

Use the $ symbol, like this:

$(‘a[href$=.pdf]‘).addClass(‘pdflink’);

 

Posted on May 24, 2011 at 2:06 PM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming · Tagged with: ,

What is a negation pseudo-class in jQuery?

It’s expressed with the :not keyword.

For example:

$(document).ready(function() {

$(‘#body_parts > li’).addClass(‘limbs’);

$(‘#body_parts li:not(.limbs)’).addClass(‘naughty_bits’);

});

This time we’re selecting all the descendants of the li tag that doesn’t have the .limbs class attached to them.

 

Posted on May 24, 2011 at 1:55 PM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming · Tagged with: ,

What is a “child combinator” in jQuery?

> sign that allows you to select a child of indicated object.

For example:

$(document).ready(function() {

$(‘#human_body > li’).addClass(‘limbs’);

});

This code says: fund all items that are children (“direct descendants”) of the #human_body ID and attach the .limbs class to them.

 

Posted on May 24, 2011 at 1:48 PM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming · Tagged with: ,

How do I remove a class from a page element with jQuery?

Use the removeClass() method. See also the enry on addClass().

Posted on May 13, 2011 at 7:59 AM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming

How do I add a class to a page element with jQuery?

Use addClass() method. Keep in mind that the name of the class in the parentheses should be enclosed in quotes and should NOT include the period before the name. For example:

$(document).ready(function() {

$(‘.myClass’).addClass(‘myOtherClass’);

});

 

 

Posted on May 13, 2011 at 7:55 AM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming

How do I clone elements with jQuery?

use clone() function.

Posted on May 5, 2011 at 6:26 PM by admin · Permalink · Leave a comment
In: Uncategorized

How do I use prepend function in jQuery?

Here’s a humorous example of both append and prepend functions:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<title>My Test Page</title>
<script type=”text/javascript” src=”js/jquery-1.5.2.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(‘html’).mousemove(function () {
$(‘div’).append(‘, magic text’);
$(‘div’).prepend(‘<strong>bold magic text</strong>, ‘);
});
});
</script>
</head>
<body>
<div>magic text</div>
<br />
<input value=”Go” type=”submit”>
</body>
</html>
Posted on May 5, 2011 at 7:56 AM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming · Tagged with: ,

How to use append() function of jQuery?

See this humorous example:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<title>My Test Page</title>
<script type=”text/javascript” src=”js/jquery-1.5.2.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(‘html’).mousemove(function () {
$(‘div’).append(‘, magic text’);
});
});
</script>
</head>
<body>
<div>Magic text</div>
<br />
<input value=”Go” type=”submit”>
</body>
</html>
Posted on May 5, 2011 at 7:50 AM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming

What plugin allows to create keyframe animations with jQuery?

http://plugins.jquery.com/project/Keyframe

Posted on May 5, 2011 at 6:52 AM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming · Tagged with: ,

What is a good visual interactive joke with jQuery?

When elements with predictable action behave unpredictably.

For example, people reach for the button, because they know they are supposed to click it, but as before they have a chance to click it, an animation happens on mouse-over, rather than on click.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<title>My Test Page</title>
<script type=”text/javascript” src=”js/jquery-1.5.2.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(‘:submit’).mouseover(function(){
$(‘div’).animate({
fontSize: ’100px’
});
});
});
</script>
</head>
<body>
<div>I’d like to say a few short words.</div>
<br />
<input value=”Animate” type=”submit”></body>
</html>
Posted on May 5, 2011 at 6:20 AM by admin · Permalink · Leave a comment
In: Uncategorized

How do I use id attribute in jQuery?

You should place a pound sine in front of the id name: #myIDName – similarly to how it’s done in CSS.

Posted on May 4, 2011 at 10:16 AM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming · Tagged with: ,

How do I add jQuery to my HTML page?

<script type=”text/javascript” src=”js/jquery-1.5.2.min.js”></script>

(The current jQuery version is 1.5.2. – it could be different when you’re reading this page.)

Posted on April 24, 2011 at 4:20 PM by admin · Permalink · Leave a comment
In: Animation, JavaScript, jQuery, Web Design, Web Programming · Tagged with: , , , ,

How do I select something that begins with a certain text using jQuery?

Use ^ symbol, like this:

$(‘a[href^=mailto:]‘).addClass(‘mailto’);

 

Posted on April 24, 2011 at 2:03 PM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming

How do I access all images that have an alt attribute with jQuery?

$(‘img[alt]‘)

 

Posted on April 24, 2011 at 1:59 PM by admin · Permalink · Leave a comment
In: JavaScript, jQuery, Web Design, Web Programming · Tagged with: ,

What is “chroma”?

Chroma, or chrominance – is a hue and saturation of the picture.