Datepicker在addrow中不起作用

时间:2015-04-21 16:05:37

标签: jquery html datepicker

<body>
    <form action="" method="post" id="form">
        <table id="datatable1" width="75%" border="0" cellpadding="2" cellspacing="2" style="border-collapse:collapse">
            <thead>
                <tr align="center" bgcolor="#" style="height:30px;color:#ffffff;">
                    <td nowrap>Sno</td>
                    <td nowrap>Name</td>
                    <td nowrap>Qualification</td>
                    <td nowrap>Date of birth</td>
                </tr>
            </thead>
            <tbody>
                <tr align="center">
                    <td>
                        <input type="text" name="sno[]" value="" id="sno" class="sno" style="margin-top:10px"><br>
                    </td>
                    <td>
                        <input type="text" name="name[]" value="" id="name" placeholder="" readonly>
                    </td>
                    <td>
                        <input type="text" name="qual[]" value="" id="qual" placeholder="" style="margin-top:10px"><br>

                    </td>
                    <td>
                        <input id="datepicker1" name="dob"/>
                    </td>
                    <td>
                        <input type="button" class="addRoww" value="ADD" id="add" name="add">
                        <input type="button" class="delRoww" value="REMOVE" id="remove">
                    </td>
                </tr>
            </tbody>
        </table>        
    </form>
</body>


$(document).ready(function(){
  $("#datepicker").datepicker();
});

1 个答案:

答案 0 :(得分:0)

表单ID是&#34; datepicker1&#34;但是你正在寻找&#34; datepicker&#34;。

<input id="datepicker1" name="dob"/>

我通常使用class =&#34; datepicker&#34;所以我有

$(".datepicker").datepicker();
顺便说一句,我只是查找了datepicker插件,我喜欢这个:

http://eternicode.github.io/bootstrap-datepicker/