I have this code:
page.php:
<?php
include ('include.php');
echo = '
<li>
<select name="selector" class="letter">
<option value="a" selected="selected">$a</option>
<option value="b">$b</option>
</select>
</li>
';
echo = '
<li>
<select name="a-numbers" class="number a-numbers">
<option value="$a[1][1]">$a[1][2]</option>
<option value="$a[2][1]">$a[2][2]</option>
</select>
<select name="b-numbers" class="number b-numbers">
<option value="$b[1][1]">$b[1][2]</option>
<option value="$b[2][1]">$b[2][2]</option>
</select>
</li>
';
?>
&
include.php:
<?php
$array = array(
"a" => array(
"1" => array("aaa1-value","aaa1-text"),
"2" => array("aaa2-value","aaa2-text")
),
"b" => array(
"1" => array("bbb1-value","bbb1-text"),
"2" => array("bbb2-value","bbb2-text")
)
)
);
?>
If .letter>a
is selected, .a-numbers
list should be echo-printed; and if .letter>b
is selected, .a-numbers
list should be removed and .b-numbers
should be printed.
Of course, I can create this scenario with JS and CSS display:none
; however, I can't use display:none
here. So I have to remove elements from DOM, but I can't.
Thanks for your attention.