As other client side libraries like MooTools, Prototype can be used with jQuery and they also use $() as their global function and to define variables. This situation creates conflict as $()
is used by jQuery and other library as their global function. To overcome from such situations, jQuery has introduced jQuery.noConflict()
.
Tag Archives: jQuery
jQuery Dollar Sign($)
Dollar Sign is nothing but it’s an alias for JQuery.
Example
$(document).ready(function(){
});
Over here $ sign can be replaced with “jQuery” keyword.
jQuery(document).ready(function(){
});
jQuery Starting Point Of Code Execution
The starting point of jQuery code execution is $(document).ready() function which is executed when DOM is loaded.
CDN
A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.
jQuery check if atleast one checkbox is checked
if(jQuery(“.related-checkbox:checkbox:checked”).length > 0)
jQuery modify the text box value
jQuery(“#product_name”).val (“1”);
close fancybox
For AJAX <a title=”Close” href=”javascript:jQuery.fancybox.close();”>< Back</a>
IFRAME <a title=”Close” href=”javascript:parent.jQuery.fancybox.close();”>< Back</a>
Setting equal height with jQuery
$(‘.category-products-grid > .item’).each(function() {
$(this).css(“height”, “auto”);
gridItemMaxHeight = Math.max(gridItemMaxHeight, $(this).height());
});
$(‘.category-products-grid > .item’).css(“height”, gridItemMaxHeight + “px”);
Jquery Remove Attribute
<script type=”text/javascript”>
$(“:submit”).removeAttr(“disabled”);
</script>
Remove class from element jquery
jQuery(“#element-id”).removeClass(“class-name”);