Load a modal after 5 mins inactive in the browser

Load a modal after 5 mins inactive in the browser
<script type="text/javascript">

function idleTimer() {
    var t;

    window.onload  = resetTimer; # catches windows reload

    window.onmousemove  = resetTimer; # catches mouse movements

    window.onmousedown  = resetTimer; # catches mouse movements

    window.onclick  = resetTimer; # catches mouse clicks

    window.onscroll  = resetTimer; # catches scrolling

    window.onkeypress  = resetTimer; #catches keyboard actions

    function showModal() {

        #"Your idle time is 20 minutes over")

        #show modal now


   function resetTimer() {


        t = setTimeout(showModal, 1200000);  # [time is in milliseconds (1000 is 1 second)]



# Execute the IdelTimer()
# idleTimer();

Please follow and like us:

Jquery validation min and max length

Min length method:

Description: Makes the element require a given minimum length.

Return false if the element is

  • some kind of text input and its value is too short
  • a set of checkboxes that doesn’t have enough boxes checked
  • a select and doesn’t have enough options selected

Works with text inputs, selects and checkboxes.

Makes “field” required having at least 3 characters.

<!doctype html>
<meta charset="utf-8"> 
<title>Makes "field" required having at least 3 characters.</title> 

<link rel="stylesheet" href="https://jqueryvalidation.org/files/demo/site-demos.css"> 
<form id="myform">
    <label for="field">Required, minimum length 3: </label> 
    <input type="text" class="left" id="field" name="field"> 
    <input type="submit" value="Validate!"> 
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script> 
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
// just for the demos, avoids form submit 

    debug: true, 
    success: "valid" 

$( "#myform" ).validate({ 
    rules: { 
       field: { 
          required: true, 
          minlength: 3 
Please follow and like us: