简体   繁体   English

第二选择选项没有价值

[英]Second Select option didn't get value

Please check my second select box get value, but not get value from 1st select box. 请选中我的第二个选择框获取值,但不要从第一个选择框获取值。 Please check my code where I am wrong? 请检查我的代码我错了吗?

Here is my code: 这是我的代码:

          <select class='form-control' id=class_code name=class_code 
          onchange='setTextField(this)'><option value=''>Select 
          class</option>";
         <option value=$row[class_code] >$row[class]</option>";
             }
        </select>
        <input id='cls' type = 'hidden' name = 'cls' value = '' />
           <script type='text/javascript'>
          function setTextField(dddl) {
               document.getElementById('cls').value = 
            dddl.options[dddl.selectedIndex].text;
               }
            </script>

            <select class='form-control' id=semester_id name=semester_id     
            onchange='setTextField(this)'><option value=''>Select 
             semester</option></select>
            <input id='semm' type = 'hidden' name = 'semm' value = '' />
           <script type='text/javascript'>
          function setTextField(ddl) {
              document.getElementById('semm').value = 
              ddl.options[ddl.selectedIndex].text;
                }
           </script>

Please check where I am wrong. 请检查我错了。 Thanks in advance :) 提前致谢 :)

<select class='form-control' id=class_code name=class_code onchange='setTextField1(this)'>
    <option value=''>Select class</option>";
    <option value=$row[class_code]>$row[class]</option>";
</select>
<input id='cls' type = 'hidden' name = 'cls' value = '' />
<script type='text/javascript'>
    function setTextField1(dddl) {
        document.getElementById('cls').value = dddl.options[dddl.selectedIndex].text;
    }   
</script>

<select class='form-control' id=semester_id name=semester_id onchange='setTextField(this)'>
    <option value=''>Select semester</option>
    <option value='1'>semester1</option>
</select>
<input id='semm' type = 'hidden' name = 'semm' value = '' />
<script type='text/javascript'>
    function setTextField(ddl) {
          document.getElementById('semm').value = ddl.options[ddl.selectedIndex].text;
    }
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM