if(jQuery(“.related-checkbox:checkbox:checked”).length > 0)
Tag Archives: Javascript
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”);
magento change form validation messages
1) Add a new class “over_all_fit_required_entry”
<input type=”hidden” name=”over_all_fit_selected” id=”over_all_fit_selected” class=”over_all_fit_required_entry”>
2) Add the below given code
<script type=’text/javascript’>
//< ![CDATA[
Validation.add(‘over_all_fit_required_entry’, ‘ Please select option’, function(v) {
return !Validation.get(‘IsEmpty’).test(v);
});
//]]>
</script>
Jquery Remove Attribute
<script type=”text/javascript”>
$(“:submit”).removeAttr(“disabled”);
</script>
Validate us zip code Javascript
var isValidZip = /(^d{5}$)|(^d{5}-d{4}$)/.test(zip);
if(isValidZip==false)
alert(“Invalid zip”);
Javascript prototype assign value to textbox
$$(‘[id=”product_id”]’)[0].value=”Test”;
Nivo slider hide prev/next buttons if there is only one image
<script type=”text/javascript”>
jQuery(function($){
if(jQuery(‘.nivoSlider’).find(‘img’).length>1){
$(‘#slider’).nivoSlider({
effect: ‘fade’ // Specify sets like: ‘fold,fade,sliceDown’
});
}
});
</script>
Back to the previous page Javascript
<script>
window.history.back()
</script>