<script> var observer; if (window.attachEvent) { observer = function (element, event, handler) { element.attachEvent(‘on’+event, handler); }; } else { observer = function (element, event, handler) { element.addEventListener(event, handler, false); }; } function init (maximumHeight) { var text = document.getElementById(‘text’); var maxHeighter=maximumHeight; var olderHeight= text.scrollHeight; var newerHeight; function resize () { text.style.height = ‘auto’; newHeight=…
Category: jQuery
How to get the current URL in javascript and jquery?
Using the following jQuery script get the current loading URL Jquery -: var href = jQuery(location).attr(‘href’); Javascript-: var href = window.location.pathname; jQuery(document).ready(function() { setTimeout(function() { window.location.href = href; }, 3000); });
add css style using jQuery
Programmers using this technique for dynamic css styling. For Example: jQuery(“#smarttips.in-email”).css(“border-color”, “#C00”);
How to download or print a page using PHP and javascript
jQuery(‘.payment-print’).live(‘click’, function() { var sUrl = jQuery(‘#base-url’).val() + ‘/jobs/paymentprint/id/’ + jQuery(this ).attr(“id”); jQuery.post(sUrl, function(data){ var HTML = data; var WindowObject = window.open(” “, “PrintWindow”, “width=769,height=601,top=40,left=40,toolbars=no”); WindowObject.document.writeln(HTML); WindowObject.document.close(); WindowObject.focus(); WindowObject.print(); WindowObject.close(); }) });
jquery file upload-restrict number of files
Parameter: maxNumberOfFiles: 1 jQuery(‘#fileupload-1’).fileupload({ dataType: ‘json’, autoUpload : true, sequentialUploads:true, uploadTemplateId: ”, downloadTemplateId: ”, crossDomain: true, maxNumberOfFiles: 1, });