Skip to content

Instantly share code, notes, and snippets.

@nfaiz
Last active November 5, 2020 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfaiz/3859600 to your computer and use it in GitHub Desktop.
Save nfaiz/3859600 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>#</title>
</head>
<body>
<form id="dafter" method="post" action="proses.php">
<div id="data">
<input type="checkbox" name="id_staf[]" value="" />
<input type="text" name="catatan[]" value="" disabled />
<br />
<input type="checkbox" name="id_staf[]" value="" />
<input type="text" name="catatan[]" value="" disabled />
<br />
<input type="checkbox" name="id_staf[]" value="" />
<input type="text" name="catatan[]" value="" disabled />
<br />
<input type="submit">
</div>
</form>
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#data input[type=checkbox]").each(function (index) {
$(this).click(function () {
var $catatan = $($('#data input[type=text]')[index]);
if ($(this).is(':checked')) {
$catatan.removeAttr("disabled");
} else {
$catatan.attr("disabled", "disabled");
}
});
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment