<script type="text/javascript"> $(document).ready(function() { // Function to update options in the second select box function updateSelectBox2() { var selectedValue = $('#to').val(); $('#approversList option').show(); // Show all options initially $('#approversList option').each(function() { if ($(this).val() === selectedValue) { $(this).hide(); // Hide the selected value from selectBox1 } }); }
// Event listener for changes in the first select box $('#to').change(function() { updateSelectBox2(); });
// Initial call to update selectBox2 on page load updateSelectBox2(); }); </script> </body> </html>
i put a js code inside custom html but it does not running correctly
i use a downloaded joget at my windows
this is the code
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
// Function to update options in the second select box
function updateSelectBox2() {
var selectedValue = $('#to').val();
$('#approversList option').show(); // Show all options initially
$('#approversList option').each(function() {
if ($(this).val() === selectedValue) {
$(this).hide(); // Hide the selected value from selectBox1
}
});
}
// Event listener for changes in the first select box
$('#to').change(function() {
updateSelectBox2();
});
// Initial call to update selectBox2 on page load
updateSelectBox2();
});
</script>
</body>
</html>