function postvalue() { $flag = getValues(); if($flag){ $('#modal_container').modal('hide') postAjax(); } else { alert("Kindly input all values"); } } function showNextDate() { $title = "INR Checkup"; $message = "Test INR between 4-7 days
"; showAlert($title,$message); $( ".pok" ).focus(); } $("#modal_container").on("hidden.bs.modal", function () { // put your default event here if($(this).parent().find('.fok').length == 1) { $( "#pid" ).focus(); } }); function showAlert($title,$message) { $("#modal-ajax").html($message); $(".modal-header").addClass('modal-head-css'); $(".modal-title").css("font-size","1.5em"); $(".modal-title").html($title); $(".modal-title").css('font-weight','bold'); $("#modal_container").modal(); return true; } function getValues() { $age = $('#age').val(); $gender = $('.sp_focus').attr('id'); $drug = $('.d_focus').attr('name'); $proc = $('.sel').attr('id'); $oinr = $('#oinr').val(); $ninr = $('#ninr').val(); $dose = $('#dose').val(); $pid = $('#pid').val(); if($age!='' && $gender!='' && $drug!='' && $proc!='' && $oinr!='' && $ninr!='' && $dose!='' && $pid!='') { return true; } else { return false; } }