Wednesday, 19 August 2015

dynamic element add each function jquery


$("#regproduct").click(function() {
            $("#specification .parameter").each(function(i, obj)
            {
                var data = $(this).select2("val");
                if (data == '')
                {
                    $("#specificationshow").show();
                    return false;
                }
            })
        })

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

Friday, 26 December 2014

payment gateway

http://phpfour.com/blog/2009/02/php-payment-gateway-library-for-paypal-authorizenet-and-2checkout/

Monday, 10 November 2014

multi level menu only css

<!DOCTYPE html>
<html>
    <head>
    <style>
    ul{width:100%}
   
    ul li{
        display:block;list-style-type:none;width:200px;background:red;border:1px solid;float:left
        }
        ul li a{
            padding:20px 30px;text-decoration:none;color:white;
        }
        ul li ul{
            width:300px;
            margin-left:-40px
           
            }
            ul ul{
                display:none;
                }
               
    ul li:hover {
    background-color: green;
    color: #FFF;
}
   
     ul li:hover > ul {
display: block;
}   
ul ul ul {
        position: absolute; left:100%; top:0;
    }
 ul ul li {
            float: none;
            border-top: 1px solid #6b727c;
            border-bottom: 1px solid #575f6a; position: relative;
        }

    </style>
    </head>
<body>
<ul>
    <li><a href="#">home</a></li>
    <li><a href="#">About Us</a>
    <ul>
    <li><a href="#">home</a>
    <ul>
    <li><a href="#">home</a></li>
    <li><a href="#">About Us</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">Contact US</a></li>
</ul>
    </li>
    <li><a href="#">About Us</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">Contact US</a></li>
</ul></li>
    <li><a href="#">Services</a>
    <ul>
    <li><a href="#">home</a></li>
    <li><a href="#">About Us</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">Contact US</a></li>
</ul>
    </li>
    <li><a href="#">Contact US</a></li>
</ul>

</body>
</html>