第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為表中的動態(tài)文本框設置類驗證

為表中的動態(tài)文本框設置類驗證

瀟瀟雨雨 2019-06-21 16:27:14
為表中的動態(tài)文本框設置類驗證我想將驗證類添加到表中的所有文本框中。因此,當用戶單擊“保存”按鈕時,它將檢查所有文本框。我嘗試使用這個jQuery來實現(xiàn)這一點: $('#tbTargetDetails tr').each(function () {             $(this).find('td input:text').each(function (i,a) {                 // get each of the textbox and add validation class to it             });         });我使用有類的MVC 5、jQuery-1.10.2.js、jQuery-1.10.2.min.js、jquery.Value*&Site.css。輸入.驗證.錯誤在我的模特中: public class ClsTargetInfo     {         public string ItemNumber_Target { get; set; }         [Required]         public string TargetColor_U { get; set; }         [Required]         public string TargetColor_V { get; set; }         [Required]         public string D90Target_U { get; set; }         [Required]         public string D90Target_V { get; set; }         [Required]         public string D10Target_U { get; set; }         [Required]         public string D10Target_V { get; set; }         [Required]         public string Thickness { get; set; }         [Required]         public string FilmWidth { get; set; }         [Required]         public string TargetDate { get; set; }     }我在另一個模型中調用上面的模型:public class abc{  public IList<ClsTargetInfo> TargetInfo { get; set; }}請幫助解決我的問題。真的很感謝你們的幫助。謝謝。
查看完整描述

2 回答

?
蕭十郎

TA貢獻1815條經(jīng)驗 獲得超13個贊


<script src="Scripts/jquery-1.10.2.min.js"></script>

<script type="text/javascript">

    $(document).ready(function () {


        function DeleteRow(btn) {


            //alert("delete" + btn);

            var tr = btn.closest('tr');

            tr.remove();

        }

        $(".btnsd").click(function () {

            // debugger;

            alert("hjkghk");

            divs = $('.val')

            for (ind in divs) {

                var div = divs[ind];

                if (div.value == "") {

                    div.focus();

                    return false;

                }

            }

            $('#Employertbl').append(

                                    '<tr>' +

                                        '<td> @Html.TextBox("item.employer_name", null, new { @class = "form-control val" })</td>' +

                                        '<td width="24%"> <div style="float:left; padding-right:5px;">@Html.TextBox("item.duration_From", null, new { @id = "", @placeholder = "From Date", @class = "form-control input-date datepicker val", @readonly = true })</div> ' +

                                              '<div>@Html.TextBox("item.duration_to", null, new { @id = "", @class = "form-control input-date datepicker val", @placeholder = "To Date", @readonly = true })</div></td>' +

                                        '<td> @Html.TextBox("item.designation", null, new { @class = "form-control val" })</td>' +

                                        '<td> @Html.TextBox("item.worked_skill", null, new { @class = "form-control val" })</td>' +

                                        '<td> @Html.TextBox("item.proj_handled", null, new { @class = "form-control val" })</td>' +

                                        '<td>  @Html.CheckBox("item.current_employed",new{@class = "current" })</td>' +

                                        '<td><input type="button" value="Remove" onclick="DeleteRow(this)" name="delete" class="btn blue pull-right" /> </td>' +

                                    '</tr>'

                                    );




        });

    });

</script>



<div class="table-responsive">

    <table id="Employertbl" class="table table-striped table-bordered table-hover dataTable no-footer">

        <tbody>

            <tr>

                <th>Employer Name</th>

                <th>Duration</th>

                <th>Designation</th>

                <th>Worked skill(s)</th>

                <th>Reason of change</th>

                <th>Currently Employed</th>

                <th>Action</th>

            </tr>


            <tr>

                <td>

                    <input class="form-control val" id="item_employer_name" name="item.employer_name" type="text" value="">

                </td>

                <td width="24%">

                    <div style="float:left; padding-right:5px;"><input class="form-control input-date datepicker val hasDatepicker" name="item.duration_From" placeholder="From Date"  type="text" value="" id="dp1459328857835"></div>

                    <div> <input class="form-control input-date datepicker val hasDatepicker" name="item.duration_to" placeholder="To Date"  type="text" value="" id="dp1459328857836"></div>


                </td>

                <td>

                    <input class="form-control val" id="item_designation" name="item.designation" type="text" value="">

                </td>

                <td>

                    <input class="form-control val" id="item_worked_skill" name="item.worked_skill" type="text" value="">

                </td>

                <td>

                    <input class="form-control val" id="item_proj_handled" name="item.proj_handled" type="text" value="">

                </td>

                <td>

                    <input class="current" id="item_current_employed" name="item.current_employed" type="checkbox" value="true"><input name="item.current_employed" type="hidden" value="false">

                </td>

                <td>

                    <input id="myButton" type="button" value="add"  name="delete" class="btnsd bcbn">

                </td>

            </tr>



            <tr><td> <input class="form-control val" id="item_employer_name" name="item.employer_name" type="text" value=""></td><td width="24%"> <div style="float:left; padding-right:5px;"><input class="form-control input-date datepicker val hasDatepicker" name="item.duration_From" placeholder="From Date"  type="text" value="" id="dp1459328857837"></div> <div><input class="form-control input-date datepicker val hasDatepicker" name="item.duration_to" placeholder="To Date" type="text" value="" id="dp1459328857838"></div></td><td> <input class="form-control val" id="item_designation" name="item.designation" type="text" value=""></td><td> <input class="form-control val" id="item_worked_skill" name="item.worked_skill" type="text" value=""></td><td> <input class="form-control val" id="item_proj_handled" name="item.proj_handled" type="text" value=""></td><td>  <input class="current" id="item_current_employed" name="item.current_employed" type="checkbox" value="true"><input name="item.current_employed" type="hidden" value="false"></td><td><input type="button" id="myButton" value="add" name="delete" class="btnsd dfsd"> </td></tr>

            <tr><td> <input class="form-control val" id="item_employer_name" name="item.employer_name" type="text" value=""></td><td width="24%"> <div style="float:left; padding-right:5px;"><input class="form-control input-date datepicker val hasDatepicker" name="item.duration_From" placeholder="From Date" type="text" value="" id="dp1459328857839"></div> <div><input class="form-control input-date datepicker val hasDatepicker" name="item.duration_to" placeholder="To Date"  type="text" value="" id="dp1459328857840"></div></td><td> <input class="form-control val" id="item_designation" name="item.designation" type="text" value=""></td><td> <input class="form-control val" id="item_worked_skill" name="item.worked_skill" type="text" value=""></td><td> <input class="form-control val" id="item_proj_handled" name="item.proj_handled" type="text" value=""></td><td>  <input class="current" id="item_current_employed" name="item.current_employed" type="checkbox" value="true"><input name="item.current_employed" type="hidden" value="false"></td><td><input type="button" id="myButton" value="add" name="delete" class="btnsd"> </td></tr>

        </tbody>

    </table>

</div>


查看完整回答
反對 回復 2019-06-21
  • 2 回答
  • 0 關注
  • 490 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號