Javescript/Jquery Error: f.easing[e.animatedProperties[this.prop]] is not a function

Error: f.easing[e.animatedProperties[this.prop]] is not a function

Error: f.easing[e.animatedProperties[this.prop]] is not a function

This problem happens with jQuery Easing Plugin. This error occurs when a newer version of jquery and jquery.easing is used with an older version of the call to animate.easing.

Solution:
Use the following jQuery, JQuery Easing and JQuery Easing Compatibility
Download JQuery – Latest version from JQuery

Download JQuery – Version 1.5.2 hosted at Google

JQuery Easing Plugin – Version 1.3 by George McGinley Smith

JQuery Easing Compatibility (for use with older versions) – by George McGinley Smith

jQuery: How to add ‘onchange’ attribute in a ‘select’ tag?

<select id="sel_id">
</select>

Works for me if I use the native setAttribute().

Also, remember that you need quotes around the selector.

$("#sel_id")[0].setAttribute("onchange", "foo()");

the final html will be

<select id="sel_id" onchange="foo();" >
</select>

Also remember to define foo in the global namespace, and not inside jQuery’s .ready() function.

Source:
http://stackoverflow.com/a/3638016

Javascript: Making the entire div clickable

We could make an entire div tag clickable by redirecting the click to a page and by changing the cursor sytle to a pointer. This is good if you want your logo or your banner to be clickable, specially if the logo is embedded together with the banner. Making the entire banner clickable would be very beneficial to your site.

<div onclick="location.href='http://www.tildemark.com/';" style="cursor: pointer;">
</div>

Source:
http://www.tildemark.com/making-the-entire-div-clickable/

jQuery: Append a CSS class to any item or last item

<script type="text/javascript">
	jQuery("p:last").addClass(" last");
</script>

It’s important to note that this method does not replace a class. It simply adds the class, appending it to any which may already be assigned to the elements.

More than one class may be added at a time, separated by a space, to the set of matched elements, like so:

$("p").addClass("myClass yourClass");

(more…)

JavaScript: How to change text value in an input box?

<form name='yourForm' action="">
     <input type='text' name='yourinput' id='yourinput' value='Hello World'>
</form>

<script type="text/javascript"> 
// Assign the value to the input with the id passed in 
function replaceInputValue( idRef, val ) { 
	// Make sure browser supports getElementById  
	if(!document.getElementById ) return; 
	// Find the input by it's id 
	var inputObj = document.getElementById( idRef ); 
	if( inputObj ) { 
	// Update the value 
	inputObj.value = val; 
	}
}
replaceInputValue( 'yourinput', 'Hello Dolly' );
</script>

jQuery: Even and odd classes for series of divs

<html>
	<head>
		<style>
			.odd {
				height: 5px;
				background: #960;
			}
			.even {
				height: 5px;
				background: #09C;
			}
		</style>
		<script src="js/jquery-1.7.1.min.js"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				$('div:odd').addClass('odd');
				$('div:even').addClass('even');
			})
		</script>
	</head>
	<body>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
		<div></div>
	</body>
<html>

Resolve Mootools & jQuery Conflict

The correct place for the jQuery.noConflict() call would be after mootools, after jQuery (which you’ve got in the right order – mootools first, then jQuery), and before any other javascript code that makes use of either.

<script type="text/javascript">jQuery.noConflict();</script>

also substitute jQuery for the $, or wrapping them in this pattern:

(function($){

  // code with the jQuery $ can safely go in here

})(jQuery);
Page 1 of 3123

Pin It on Pinterest