Lunes, Pebrero 1, 2016

Datepicker format (dd/mm/yy) clears when clicked

Datepicker formats produces unpredictable results. You wanted the date format as dd/mm/yy like for example 01/06/2016 1st June 2016 (not 6th January 2016). Here's a simple solution.

First, set the header code below:

<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script>

Then your HTML:

<input type="text" class="datepicker" name="bdate" id="bdate" value="">

Lastly, your javascript:

<script type="text/javascript"> 
   $(document).ready(function(){

var val = $('#bdate').val();
$('#bdate').datepicker("option", "dateFormat", 'dd/mm/yy');
        $('#bdate').datepicker( "setDate", val); 



});

That's it.

Goodluck.


Linggo, Enero 31, 2016

A simple Auto Open Dialog box

Hi All!

Here's a simple dialog box that auto opens when page is loaded.

Add code below in your header page:

<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script>

Then, create your HTML like below:

<div id="renewalNotice" style="display: none;">
<div id="notice">
        <span class="daysLeft" >5</span>
           
            <span class="kDetails">
            Company<br />
Address<br />
Phone<br />
Email<a href="mailto:email@domain.com" style="color: #fff;">email@domain.com</a>
            </span>
        </div>
    </div>

Lastly, add our JQuery code:

jQuery('#renewalNotice').dialog({ width: 518, title: 'Important Notice', autoOpen: true, draggable: false, modal: true, resizable: false, stack: false });

That's it.

Goodluck!