Testing jQuery and Make it Non-Conflicting

When you want to test to see if jQuery is working, just add the jqtest ID to the link/a-tag you want to click for an alarm. Plus here there are two different examples on how to write jQuery without just the $, due to issues that will conflict with other JavaScript based libraries.

[javascript]
<!– Example 1: Non-Conflicting jQuery –>
jQuery(document).ready(function(){
jQuery("#jqtest").click( function() {
alert("jQuery is working!");
});
});

<!– ******************************************************* –>

<!– Example 2: Non-Conflicting jQuery –>
var $jq = jQuery.noConflict();

$jq(document).ready(function(){
$jq("#jqtest").click( function() {
alert("jQuery is working!");
});
});
[/javascript]

Leave a Reply