Posts

Showing posts from November, 2014

File Uploaded Name Rename

**************************Jquery******************************** $(function () {     $(".edit").on('click', 'span', function () {         var input = $('<input />', {             'type': 'text',                 'name': 'unique',                 'value': $(this).html()         });         $(this).parent().append(input);         $(this).remove();         input.focus();     });     $(".edit").on('blur', 'input', function () {         $(this).parent().append($('<span />').html($(this).val()));         $(this).remove();     }); }); ***********************HTML************************************* <div class="edit"> <span class="">TESTING</span> </div>

Small Screen Data-table View

****************************Jquery*********************************** $ ( document ). ready ( function  () {          var   headertext  = [],      headers  =  document . querySelectorAll ( "#customDataTable th" ),      tablerows  =  document . querySelectorAll ( "#customDataTable th" ),      tablebody  =  document . querySelector ( "#customDataTable tbody" );          for  ( var   i  =  0 ;  i  <  headers . length ;  i ++) {              var   current  =  headers [ i ];              headertext . push ( current . textContent . replace ( /\r ? \n | \r/ ,  "" ));         }          for  ( var   i  =  0 ,  row ;  row  =  tablebody . rows [ i ];  i ++) {              for  ( var   j  =  0 ,  col ;  col  =  row . cells [ j ];  j ++) {                  col . setAttribute ( "data-th" ,  headertext [ j ]);             }         }     }); **********************CSS******************************************* @media   screen  and ( max-width :

Modal + iOS virtual keyboard

***************************Jquery ************************************* // This entire section makes Bootstrap Modals work with iOS     // This entire section makes Bootstrap Modals work with iOS     if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {         $('.modal').on('show.bs.modal', function () {             setTimeout(function () {                 scrollLocation = $(window).scrollTop();                 $('.modal')                     .addClass('modal-ios')                     .height($(window).height())                     .css({ 'margin-top': scrollLocation + 'px' });             }, 0);         });         $('input').on('blur', function () {             setTimeout(function () {                 // This causes iOS to refresh, fixes problems when virtual keyboard closes                 $(window).scrollLeft(0);                 var $focused = $(':focus');                 // Needed in c