小编Spa*_*rky的帖子

尝试验证引导程序复选框时出现 Jquery 验证错误

我正在使用 Jquery 验证插件,一切正常,但是当我尝试验证复选框时出现错误:

TypeError: b is undefined
Run Code Online (Sandbox Code Playgroud)

这是我的引导复选框脚本:

<div class="col-xs-8">
                    <div class="checkbox icheck">
                        <label>
                            <input type="checkbox" required> I agree to the <a href="#">terms</a>
                        </label>
                    </div>
                </div>
Run Code Online (Sandbox Code Playgroud)

这是我使用的 jquery 验证:

$("#formRegister").validate({
            errorElement: "span",
            errorClass: "help-block",
            highlight: function (element, errorClass, validClass) {
                // Only validation controls
                if (!$(element).hasClass('novalidation')) {
                    $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
                }
            },
            unhighlight: function (element, errorClass, validClass) {
                // Only validation controls
                if (!$(element).hasClass('novalidation')) {
                    $(element).closest('.form-group').removeClass('has-error').addClass('has-success');
                }
            },
            errorPlacement: function (error, element) {
                if (element.parent('.input-group').length) {
                    error.insertAfter(element.parent());
                }
                else if (element.prop('type') === …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-validate twitter-bootstrap

0
推荐指数
1
解决办法
1061
查看次数

JQuery.Validate 仅验证第一个字段

我一整天都在为 JQuery 验证问题而苦苦挣扎。它仅验证第一个字段。

我已经成功地在这里重现它:

$(document).ready(function() {
  $('#go').click(function() {
    
    console.log('go clicked');
    
    if ($('#detailsForm').valid()) {
      alert('if you see this then the form is valid.');
    }

  });
});
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html>

  <head>
    <script data-require="jquery@1.10.0" data-semver="1.10.0" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
    <script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.js"></script>
    <script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body>
    <h1>This doesn't work :(</h1>
    
     <form id="detailsForm">

        <div class="row guttered-bottom">

            <div class="col-md-6 col-xs-12">


                <div class="row">
                    <div class="col-md-12 col-xs-12">
                        <br />
                        First Name<div style="color:#E320C9">*</div>
                        <div class="input-container">
                            <input id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-validate

0
推荐指数
1
解决办法
1619
查看次数

如何在jquery中验证此表单

<form id="myForm" runat="server">
username
<asp:TextBox ID="txtuser" runat="server">
</asp:TextBox>
Password
<asp:TextBox ID="txtpass" TextMode="Password" runat="server">
</asp:TextBox>
<asp:Button ID="btnsubmit" Text="submit" runat="server" OnClientClick="Val()" />
</form>
Run Code Online (Sandbox Code Playgroud)

这是我的源代码任何人验证它或者如果有人有任何mvc和web开发的电子书所以发布它

validation jquery

-1
推荐指数
1
解决办法
339
查看次数

用jQuery裁剪图片

能否请别人向我解释或带我如何使用JavaScript / jQuery裁剪图片?我不是在寻找插件,而是想了解它是如何完成并使用的。我也不想div操纵背景位置。我想裁剪实际图片。但仅用于客户端目的。我不需要挂钩即可保存裁切后的图片。

javascript jquery image crop

-1
推荐指数
1
解决办法
1933
查看次数

粘滞页脚在IE7中没有更新

这是一个链接,显然是粘性页脚的"最佳"解决方案(只有当页面上的内容很少时才会停靠).

http://ryanfait.com/sticky-footer/

当您在任何其他浏览器(Firefox,我测试过的Chrome)中调整窗口大小时,页脚随窗口移动.在IE7中,它不会移动,您需要刷新页面以使其正确定位.

谷歌似乎能够做到这一点,所以我想知道,他们是如何设法做到这一点的,我不能?他们使用JavaScript,还是有一个优雅的CSS解决方案,我想念?

html css internet-explorer-7

-1
推荐指数
1
解决办法
1021
查看次数

我的网站在Firefox中查看时不显示图像,但在Chrome中运行完美

我知道这不是什么新鲜事,而且会发生,但我已经没有想过要纠正什么了.我尝试验证我的网站代码,固定编码,但无济于事.

在这里:www.arturstols.com(点击徽标)

它使用jQuery在中央容器内滑动图像,但不显示.介绍图形确实如此.

html css firefox google-chrome

-1
推荐指数
2
解决办法
725
查看次数

jquery验证位置错误标签

http://s4.postimage.org/bpmlh7b65/error.jpg

这对我来说也没用,当我尝试这个时出现错误:

error.insertBefore(element)
error.css('float','left')
Run Code Online (Sandbox Code Playgroud)

要么:

error.attr('style','float:left')
Run Code Online (Sandbox Code Playgroud)

只有我可以像这样添加这些属性:

$(error).someproperty
Run Code Online (Sandbox Code Playgroud)

这是我的代码因为我无法复制粘贴,因为我在TFS上工作并且不允许复制/粘贴.问题是,使用此代码我不能float left错误消息.我希望该错误出现在文本框的左侧和下方.更重要的是,我只是在测试,我把float =right它放在上面,所以忘了它.float:left也没有用.我检查了一下.

jquery jquery-validate

-1
推荐指数
1
解决办法
8570
查看次数

JQuery验证 - 确认电子邮件表单验证

我有一个测验,我需要为一个confirm email address字段添加一些验证,基本上它只需匹配上面字段中给出的电子邮件地址.我使用以下javascript,我可以在这里添加一些东西,以确保电子邮件匹配?

if ($('#mtQuiz').length > 0) {
    $('#myQuiz').validate({
        errorElement: "em",
        errorContainer: $("#warning"),
        rules: {
            'entry[first_name]':            'required',
            'entry[last_name]':     'required',
            'entry[email]': {
                required: true,
                email: true
            },
            'entry[confirm_email]': {
                required: true,
                email: true
            }
        },
        messages: {
            'entry[first_name]':    'Please enter first name',
            'entry[last_name]': 'Please enter last name',
            'entry[email]': {
                required: ' Please enter a valid email address',
                minlength: 'Not a valid email address'
            },
            'entry[confirm_email]': {
                required: ' Please make sure email matches above',
                minlength: 'Does not match above …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-validate

-1
推荐指数
1
解决办法
1万
查看次数

PHP从数据库中检索记录

我是PHP和Web开发的新手.到目前为止,我根据我的知识写了一个简单的PHP脚本.这是它的样子,以及HTML:

<!DOCTYPE HTML>
<html>
    <title>Retrieve Users</title>
    <meta charset="utf-8">
    <body>
        <p> List of Subscribers </p>
        <?php
            $query = "select * from subscribers";
            $con = mysqli_connect("localhost","root","","subscribers");
            $result;
            if(mysqli_connect_errno()){
                header("Location: unavailable.html");
                exit;
            }else{
                $result = mysqli_query($con,$query);
            }
        ?>
        <table>
            <?php 
                global $result;
                while( $row = mysqli_fetch_array($result) ){
                    $email = $row['email'];
                    echo "<tr>";
                    echo "<td>"  $email  "</td>";
                    echo "</tr>";
                }
            ?>
        </table>
    </body>
</html>  
Run Code Online (Sandbox Code Playgroud)

但是,我在我的网页上看到了这个:

List of Subscribers

"; echo ""; echo ""; } ?>
" $email "  
Run Code Online (Sandbox Code Playgroud)

我需要在这做什么改变?

php

-1
推荐指数
1
解决办法
102
查看次数

使用jQuery Validate在条件上应用验证

早上好,我想知道您是否可以在这个问题上对我有所帮助:当另一个输入值满足条件时,我将根据需要对select元素应用验证。我正在使用验证jQuery插件来做到这一点。这是伪代码:(if(textbox == "valueX"){mySelectEelement is required;}表示我必须从select元素中选择一个值。)。因此出于某种原因,select元素未采用我想应用的验证。

请查看我为此目的在Plunker上创建的完整示例代码:

<html lang="en">
<head>
 <title></title>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script src="https://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script>
$( function() {
$.validator.setDefaults({
      //debug: true,
      success: "valid"
    });

    $( "#myform" ).validate({
      rules: {
        borough: {
              required: false
        }
      }
    });

    $('#state').on('change', function () {
    if ($(this).val().toUpperCase() == "NY" || $(this).val().toUpperCase() == "NEW YORK") {
        $('#borough').rules('add', {
            required: true
        });
    } else{
       $('#borough').rules('remove');
    }
});    
} );
</script>

</head>
<body>
<form id="myform">
<div>
<p id="pid"></p>
<input id='text' type='text' …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-validate

-1
推荐指数
1
解决办法
1450
查看次数