I got this script which works perfectly fine on fiddle, but not working on my website.
Code on site:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(".hiddenInput").hide();
$(".showHideCheck").on("change", function() {
$this = $(this);
$input = $this.parent().find(".hiddenInput");
if($this.is(":checked")) {
$input.slideDown();
} else {
$input.slideUp();
}
});
</script>
</head>
<body>
<form>
<div class="option">
<input type="checkbox" name="chkBox1" id="chkBox1" class="showHideCheck" />Click me to show the text box
<br/><div class="hiddenInput"> Enter
<input type="text" name="txtBox1"/></div>
</div>
<div class="option">
<input type="checkbox" id="chkBox2" name="chkBox2" class="showHideCheck" />Click me to show the text box
<br/><div class="hiddenInput">Enter
<input type="text" name="txtBox2"/></div>
</div>
</form>
</body>
</html>