Enable / Disable to datetime picker JQuery

At HMTL

 

<div id=”start_dateDiv”>
<span>Start Date:</span>
<input type=”text” name=”str_start_date” id=”str_start_date” style=”width: 170px”/>
</div>
<script type=”text/javascript”>
$(function() {
$( “#str_start_date” ).datepicker({
dateFormat: ‘dd M yy’,
changeMonth: true,
changeYear: true,
showOn: “button”,
buttonImage: “/images/icon_calendar.gif”,
buttonImageOnly: true,
altField: “#report_start_date”,
altFormat: “yy-mm-dd”,
yearRange: “-10:+10”
});
});
</script>

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
At Javascript

function Change(){
$(“#start_dateDiv”).children().prop(‘disabled’,false);
$(“#start_dateDiv”).children(“img”).fadeIn(“slow”);

OR
$(“#start_dateDiv”).children().prop(‘disabled’,true);
$(“#start_dateDiv”).children(“img”).fadeOut(“slow”);
}
_________________________________________________

Advertisements

HTML Validation

Knowledge Sharing

Integer Filter for Input Textbox in HTML

<!doctype html>
<html>
<head>
</head>
<body>
<input type=”text” onkeypress=”if(this.value.match(/\D/)) this.value=this.value.replace(/\D/g,”)”
onkeyup   =”if(this.value.match(/\D/)) this.value=this.value.replace(/\D/g,”)” name=”test” id=”test”  style=”width: 200px;” />
</body>
</html>

reference : http://www.javascripter.net/faq/keyboardinputfiltering.htm


Integer Filter for Input Textbox in HTMLwith JQUERY

<!doctype html>
<html>
<head>
</head>
<body>
<input type=”text” id=”test” name=”test” style=”width: 200px;” />
<input type=”text” id=”test2″ name=”test2″ style=”width: 200px;” />


$(document).ready(function() {
$(“#test,#test2”).keydown(function (event) {
// Prevent shift key since its not needed
if (event.shiftKey == true) {
event.preventDefault();
}
// Allow Only: keyboard 0-9, numpad 0-9, backspace, tab, left arrow, right arrow, delete
if ((event.keyCode >= 48 && event.keyCode = 96 && event.keyCode // Allow normal operation
} else {
// Prevent the rest
event.preventDefault();
}
});

});

</body>
</html>


View original post