首页 > 解决方案 > 无法在 php 中选择下拉菜单时隐藏 div

问题描述

嗨,我有一个基于下拉选择 div 值的下拉菜单应该更改。默认情况下,它不显示并显示 div,如果我选择是,则显示一个文本框,而另一个 div 不隐藏。

<div class="col-sm-12"> 
                                        <select name="full_part_time" id="full_part_time" onchange="if (this.value=='yes'){this.form['full_part_time_details'].style.visibility='visible'}else {this.form['full_part_time_details'].style.visibility='hidden'};">
                                            <option value="no" <?php echo ($oppointArr['full_part_time'] == 'no')?'selected':''?>>no</option>
                                            <option value="yes" <?php echo ($oppointArr['full_part_time'] == 'yes')?'selected':''?>>yes</option>                                                
                                        </select>
                                        <?php 
                                            $visibleText = 'style="visibility:hidden;"';
                                            if($oppointArr['full_part_time'] == "yes"){
                                                $visibleText = 'style="visibility:visible;"';
                                            }
                                        ?>
                                        <input type="text" id="full_part_time_details"  <?php echo $visibleText;?> value="After my retirement, I am not in full or part time employment or Service not engaged in any trade or business or profession till today. " readonly/>
                                        <?php //print_r($oppointArr); ?>                                            
                                        
                                        <div class="droddownsselection">
                                            <p>Service Candidates shall upload following documents along with service Affidavit. </p>
                                            <ul style="list-style:none;">
                                                <li>1. Retirement Order / Service Certificate.</li>
                                                <li>2. Permission Letter from Employer</li>
                                                <li>3. Proof of working during study period of LAW</li>
                                                <li>4. Law T.C.</li>
                                            </ul>
                                        </div>
                                        
                                    </div> 

标签: php

解决方案


推荐阅读