选择选项不显示必填字段

时间:2018-03-19 21:33:24

标签: jquery jquery-ui

我想通过jquery添加一些书名来发行书籍清单。但是我找不到问题。任何人都可以帮助我吗?而且,jquery运行良好。

jquery脚本代码:

<script>
$(document).ready(function(){ 
        //department id dhorbo
        $("#department").change(function(){
            var depid = $("#department").val();
            $.ajax({
                type:"POST",
                url:"<?php echo base_url(); ?>manage/getBookByDepId/" + depid,
                success:function(data){
                    //book form maje show korbo
                    $("#book").html(data);
                }
            });
        });
    });
</script>

<form action="<?php echo base_url();?>manage/addIssueForm" method="post">

            <div class="form-group">
                <label>Departmant</label>
                <!-- <input type="text" name="dep" class="form-control span 12"> -->
                <select name="dep" id="department">
                    <option value="">Select...</option>
                    <?php 
                            foreach ($depdata as $ddata){
                        ?>
                        <option value="<?php echo $ddata->depid; ?>">
                        <?php echo $ddata->depname; ?></option>
                    <?php } ?>
                </select>
            </div>

            <div class="form-group">
                <label>Book Name</label>
                <select name="bookname" id="book" class="form-control span 12"></select>
            </div>

            <div class="form-group">
                <input type="submit" clss= btn btn-primary value="Submit">
            </div>

        </form>

0 个答案:

没有答案