私信  •  关注

Hien Nguyen

Hien Nguyen 最近创建的主题
Hien Nguyen 最近回复了
7 年前
回复了 Hien Nguyen 创建的主题 » 如何使用jquery计算文本框中剩余的字符数

是否包含所有相关的css和脚本?

我复制了一个关于MaxLength库的演示。它工作得很好。

 $(function () {
        //Normal Configuration.
        $("#TextBox1").MaxLength({ MaxLength: 10 });
 
        //Specifying the Character Count control explicitly.
        $("#TextBox2").MaxLength(
        {
            MaxLength: 15,
            CharacterCountControl: $('#counter')
        });
 
        //Disable Character Count.
        $("#TextBox3").MaxLength(
        {
            MaxLength: 20,
            DisplayCharacterCount: false
        });
    });
 <script type="text/javascript" src='https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js'></script>
    <script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js'></script>
    
    <!--[if lt IE 9]>
      <script type="text/javascript"  src='https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js'></script>
    <![endif]-->
    <script src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.24/jquery-ui.min.js" type="text/javascript"></script>
    <script src="https://www.aspsnippets.com/demos/2649/MaxLength.min.js"></script>
    <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.24/themes/start/jquery-ui.css" type="text/css" />

<input type="text" id="TextBox1" style="width: 300px" value = "Mudassar Khan" />
<br />
<br />
<div id="counter" style="color:red;font-weight:bold"></div>
<input type="text" id="TextBox2" style="width: 300px" />
<br />
<br />
<input type="text" id="TextBox3" style="width: 300px" />
6 年前
回复了 Hien Nguyen 创建的主题 » jquery datatable插件磨损不起作用

您的问题丢失,并且您的ID包含来自 id="myDataTable " id="myDataTable"

$("#myDataTable").DataTable();

并将tr改为thead作为表头

 <thead>
       <th>EmployeeName</th>
       <th>DepartmentName</th>
       <th>Salary</th>
  </thead>

$(document).ready(function () {
     $("#myDataTable").DataTable();
 });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<html>
<head>
<link href="bootstrap.css" rel="stylesheet"  type="text/css"/>
<link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet"  type="text/css"/>


<script type="text/javascript" language="javascript"  src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="bootstrap.js"></script>

</head>
<body>
<div class="panel panel-body">      

    <div class="col-md-9">
        <table id="myDataTable" class="display">
            <thead>
                <th>EmployeeName</th>
                <th>DepartmentName</th>
                <th>Salary</th>
             </thead>
            <tbody>
                <tr>
                    <td>Noosh</td>
                    <td>Psian</td>
                    <td>1000</td>
                </tr>
                <tr>
                    <td>Nil</td>
                    <td>AD</td>
                    <td>2000</td>
                </tr>
                <tr>
                    <td>Neg</td>
                    <td>Amatis</td>
                    <td>3000</td>
                </tr>
                <tr>
                    <td>Neg2</td>
                    <td>Amatis</td>
                    <td>3000</td>
                </tr>
                <tr>
                    <td>Neg3</td>
                    <td>Amatis</td>
                    <td>3000</td>
                </tr>
                <tr>
                    <td>Neg1</td>
                    <td>Amatis</td>
                    <td>3000</td>

                </tr>
        </table>
    </div>
</div>

 </body>
 </html>
6 年前
回复了 Hien Nguyen 创建的主题 » 如何删除ol child在jquery中没有li的li元素?

您可以使用查询选择器 #myUL li ol 去查一下里面的李。

$(document).ready(function() {
  $('#myUL li ol').each(function() {
    var lenLi = $(this).find('li').length;
    console.log(lenLi);
    if (lenLi == 0) {
      $(this).remove();
    }
  })
})

$(document).ready(function() {
  $('#myUL li ol').each(function() {
    var lenLi = $(this).find('li').length;
    console.log(lenLi);
    if (lenLi == 0) {
      $(this).remove();
    }
  })
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<ol id="myUL">
  <li>Hello 1</li>
  <li>Hello 2
    <ol></ol>
  </li>
  <li>Hello 3
    <ol>
      <li>Hello 3.1</li>
      <li>Hello 3.2</li>
      <li>Hello 3.3</li>
    </ol>
  </li>
</ol>

你应该改变 ActionResult JsonResult . 然后像这样回来:

return Json(new {url: "yoururl", inv: yourdata}, JsonRequestBehavior.AllowGet);
7 年前
回复了 Hien Nguyen 创建的主题 » c mysql错误system.data.sqlclient.sqlException:

你需要安装 MySql.Data 对于MySQL Install-Package MySql.Data

使用 MySqlConnection 而不是 SqlConnection

参考 How to connect to MySQL Database?