I explained my problem, I have an overlay that I used to delete the categories. I add an action to let you choose where to go when the job categories will be deleted.
For this, I use checkbox and I add a javascript function “open” a form when the checkbox is click,
here is an exemple box close:

here is an exemple box open:

My html code:
<form method="get">
<input type="radio" name="cat_action" value="delete" /> Delete all tracks<br />
<input type="radio" name="cat_action" value="move" onclick="showMe('div_<?php echo $value->ID ?>', this)" /> Move tracks<br />
<div id="div_<?php echo $value->ID ?>" style="display:none">
<label for="track">Move tracks to: </label>
<select id="cate" name="cate">
<?php foreach (arrayToObject($startup->getCat()) as $value) { ?>
<option value="<?php echo $value->ID ?>"><?php echo $value->post_title ?></option>
<?php } ?>
</select> <br />
</div><br />
<button type="submit"> OK </button>
<button type="button" class="close"> Cancel </button>
</form>
My javascript code:
<script type="text/javascript">
function showMe (it, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = vis;
}
</script>
My problem:
When the checkbox opens the list, it does not close when I click on first checkbox.
I just want to create a function that closes the second checkbox.
You can try it here: http://jsbin.com/usituv/3/edit
The problem is due to the fact that you don’t do anything on the “Delete” option selection – only on “move” selection. Below is how I updated your script to work properly (provided I understand what you’re after). Specifically note the changes:
idattribute to the move radio buttononclickhandler to the delete radio buttongetElementByIdfunction to retrieve the reference to the move radio button inside the javascript function.Also note that it would be better to separate all your javascript into a separate file, including assigning the
onclickhandlers. However I’m simply fixing your problem at hand here.