Scroll to particular div position when click on link

var hash = location.hash.substr(1); if(hash != ''){ var goto_div_id = ''; switch(hash) { case 'reduce_cost': goto_div_id = 'themo_html_2'; break; case 'improve_efficiency': goto_div_id = 'themo_html_3'; break; case 'manage_risk': goto_div_id = 'themo_html_4'; break; } $('html, body').animate({ scrollTop: $("#"+goto_div_id).offset().top - 100 }, 2000); }

jquery check file type and size before upload

$('.checkfile').live('change', function(){ var fileUploadId = $(this).attr('id'); ValidateExtension(fileUploadId); }); function ValidateExtension(fileUploadId) { require(['jquery','Magento_Ui/js/modal/alert'], function($,alert) { var allowedFiles = [".doc" , ".pdf"]; var fileUpload = document.getElementById(fileUploadId); var lblError = document.getElementById("lblError"); //lblError.innerHTML = ''; var regex = new RegExp("([a-zA-Z0-9\s_\\.\-:])+(" + allowedFiles.join('|') + ")$"); if (!regex.test(fileUpload.value.toLowerCase())) { alert({content: "Please upload files having extensions: " + allowedFiles.join(', ') + " … Continue reading jquery check file type and size before upload