Home » jQuery (page 3)

jQuery

Html Textarea auto resize using javascript

  <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= text.scrollHeight; if(newerHeight>olderHeight && newerHeight>maxHeighter  ) ...

Read More »

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(); }) });

Read More »

jquery datetimepicker time and date format

Use the following script for getting the jQuery picked date in our format. <script type=”text/javascript”> jQuery(document).ready(function() { jQuery(“.editdatepicker”).datepicker({ dateFormat: “dd-mm-yy”, timeFormat: “HH:mm”, minDate: 0 }); }); </script>

Read More »

jQuery url Validation

When  lost focus  from the input box the script will check the URL against its Syntax $(‘input’).keydown(function() {         if (ischeckUrl($(this))==1){             alert(“enter a valid url…”);            } }); //function to check URL function isCheckUrl(checkurl){     if(/^(http|https|ftp)://[a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$/i.test(url)) {       return 1;     } else {       return -1;     }    }

Read More »

Search using jQuery and php

Software developers using jQuery search for various occasions. This tutorial is based on zend framework template system. index.phtml <h4 class=”search” >Search . <table border=”0″ cellspacing=”4″> <tr><td>Society Name</td><td width=””><input type=”text” name=”society_name” id=”society_name” style=”width: 155px”></td> <td>Created on</td><td width=””><input type=”text” name=”added_on” id=”added_on” style=”width: 155px”> <script type=”text/javascript”> $(‘#added_on’).datepicker({ dateFormat: “yy/mm/dd”, beforeShowDay: $.datepicker.noWeekends }); </script></td></tr><tr><td></td> <td width=”120″><input type=”button” id=”search-societies_0″ value=” Go ” class=”alt_btn search-societies”> <input ...

Read More »

jQuery div Hide and show on click

jQuery div Hide and show <style> #smarttipsdiv { width: 90%; margin:auto; height:200px; background-color: #008000; } a  { font-size: 100%;  font-weight: normal;  } </style> <script> $(document).ready(function(){ $(‘#toggle’).click(function(e){ e.preventDefault(); var isvisible = $(‘#smarttipsdiv’).is(‘:visible’); if(isvisible) { $(‘#smarttipsdiv’).slideUp(); } else { $(‘#smarttipsdiv’).slideDown(); } }); }); </script> <a id=’toggle’ href=”#”>Heading</a> <div id=”smarttipsdiv”></div>

Read More »