Ok, let's start with an example.
Keep in mind this is just an example.
<select id = "selection1">
<option value = "1" id = "1">Number 1</option>
<option value = "2" id = "2">Number 2</option>
<option value = "3" id = "3">Number 3</option>
</select>
Now we have a drop-down list with three parameters.
Now I want to hide the option.
Adding style = "display:none" will help.
The option will not appear in the drop-down list, but using the arrow keys you can still select it.
Essentially, it does exactly what the code says. It does not appear, and it stops.
The jQuery $("#1").hide() function will not work.
In addition, I do not just want to hide this option, I want to completely remove it.
Is there such an opportunity?
Should I use parent / sibling / child elements? If so, I'm still not sure how to do it.
Any help on this would be greatly appreciated. Thanks.
Another question - He tied
So, I found out that there is .remove() in jQuery. It works well.
But what if I want to return it?
if (condition)
{
$ (this) .remove ();
}
I can do it. It should not be difficult.
But what I'm trying to do is the following:
Maximum class capacity: (input field here)
Select a room: (drop-down list here)
I would like this update to be Dropdown with a function like .change() or .keyup .
I could only create a drop-down list after something is printed. When changing or in the keyboard, follow the drop-down list accordingly.
But I do this:
$ roomarray = mysql_query ("SELECT *
of
(
HAPPENING
WHEN type = 'Auditorium' THEN 4
END AS ClassTypeValue
FROM numbers
) t
ORDER BY ClassTypeValue, maxppl, roomID ");
echo "<select id = \"room\">"; while ($rooms = mysql_fetch_array($roomarray)) { ?> <option value=<?php echo $rooms['roomID']; ?> id=<?php echo $rooms['roomID']; ?>><?php echo $rooms['type']; echo " "; echo $rooms['roomID']; echo " ("; echo $rooms['maxppl']; echo ")"; ?></option> <?php } echo "</select>";
Yes, I know this is very dirty. I plan to change it later.
But now the problem is this: can I switch the removal of options according to what was printed?
Can this be done with a drop-down list from a loop? Since I'm sure the devil cannot continue to execute SQL queries. Or is it even an option? Because, if possible, I still think it's bad.