Friday 26 June 2015

find charecter in array

 $array=your array

foreach($array as $key=>$val)
            {
                $pos = stripos($val['name'],$searchkey);
                if($pos!== false)
                {
                 
                    $returnarray[]=$usertypearray[$key];
                  
                }
            }
        }

Thursday 18 June 2015

numeric value insert only

 /*
    * only numeric value insert in specification
    */
  //called when key is pressed in textbox
   $("body").on('keypress','.numeric',function (e) {
     //if the letter is not digit then display error and don't type anything
     if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
       
               return false;
    }
  
  });
 

});

$(document).ready(function(){
    $(document).on("cut copy paste",".numeric",function(e) {
        e.preventDefault();
    });
 });

Thursday 11 June 2015

onbeforeunload unbind/bind on page before leave page

For unbind
  window.onbeforeunload = null;

For Bind
    
  function closeIt()
  {
    return "Are you sure you want to cancel this posting?";
  }
  window.onbeforeunload = closeIt;

Monday 1 June 2015

set maxdate depend on mindate in datepicker

     var startDate = $(this).datepicker('getDate');
                   startDate.setDate(startDate.getDate() +30);
                    $("#offer_expiredate").datepicker("option", "minDate", selected);