Can anyone point out what I have done wrong here please:
This should hide a <div> section when a user selects either of the last 2 options in a select box.
function showDets(item){
var selForm = document.insert;
var selChoice = selForm.dt.options.[selForm.dt.selectedIndex].value;
if(selChoice == "GN" || selChoice =="SB")
{
item.style.display == "none";
//alert("this code has reached here" + selChoice);
}
}
relevent page code:
<form name='insert' method='post' action='update.php'>
<select name='dt' onChange='showDets(dets)'>
<option value=0>Choose
$optionsc //php list of options
</select>
<div class='dets' id='dets'>
//div code html here not relevent
</div>
The options are populated from a database by php the values of the last 2 of which are "GN" and "SY".
I know that the if statement is reached on selection of either of the last 2 options because the alert displays (when not commented out)however the div won't hide.
Thanks.
This should hide a <div> section when a user selects either of the last 2 options in a select box.
function showDets(item){
var selForm = document.insert;
var selChoice = selForm.dt.options.[selForm.dt.selectedIndex].value;
if(selChoice == "GN" || selChoice =="SB")
{
item.style.display == "none";
//alert("this code has reached here" + selChoice);
}
}
relevent page code:
<form name='insert' method='post' action='update.php'>
<select name='dt' onChange='showDets(dets)'>
<option value=0>Choose
$optionsc //php list of options
</select>
<div class='dets' id='dets'>
//div code html here not relevent
</div>
The options are populated from a database by php the values of the last 2 of which are "GN" and "SY".
I know that the if statement is reached on selection of either of the last 2 options because the alert displays (when not commented out)however the div won't hide.
Thanks.