jquery-plugins 相关问题

jQuery库的自定义附加组件和插件。 jQuery函数和功能未包含在标准jQuery库中。

在不同步骤上带有两个术语复选框的多步表单无法使用 jQuery 验证插件正确验证?

有两个复选框的表格,用于就不同步骤(第一个和最后一个)达成一致。第一个工作完全正常,但最后一步工作不正常。 这是html代码 有两个复选框的表格,用于就不同步骤(第一个和最后一个)达成一致。第一个工作完全正常,但是最后一步工作不正常。 这里是html代码 <form method="post" id="prizeRegistration" action="submit_book.php" enctype="multipart/form-data"> <fieldset id="step1" class="publisher"> <div class="stepSec01"> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="email">Are you a Publisher?<span class="strik">*</span></label> <div class="check"> <ul class="radioCls"> <li> <input type="radio" id="Yes" checked="" name="publisher" value="yes"> <label for="Yes"> <span></span>Yes</label> </li> <li> <input type="radio" id="No" name="publisher" value="no"> <label for="No"> <span></span>No</label> </li> </ul> <div class="error" id="error_publisher"></div> </div> </div> </div> .... .... .... <div class="col-md-12"> <div class="form-group"> <div class="checkbox"> <p>By checking the box below, you hereby declare that all information submitted by you holds true.<span class="strik adStrik">*</span></p> <input type="checkbox" id="agreement" name="agreement" value="agree" /> <label for="agreement"> <span></span>I agree</label> </div> <div class="error" id="error_agreement"></div> </div> <div class="form-group"> <a href="javascript:void(0)" id="stepone" class="btn next">Next</a> </div> </div> </div> </div> </fieldset> <fieldset id="step2" class="book" style="display:none;"> ... </fieldset> <fieldset id="step3" class="author" style="display:none;"> .... </fieldset> <fieldset id="step4" class="editor" style="display:none;"> ..... </fieldset> <fieldset id="step5" class="declaration" style="display:none;"> <div class="stepSec05"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <div class="checkbox"> <p>I hereby declare that all information submitted as part of the form is true to my knowledge. Any information shared with me (as a representative of my Publishing House) will be kept confidential. A breach in the same will lead to the disqualification of the entries made by the Publishing House, for the foreseeable future.<span class="strik">*</span> </p> <input type="checkbox" id="declaration" name="declaration" value="agree" /> <label for="declaration"><span></span>I Agree</label> <div class="error" id="error_declaration"></div> </div> </div> <div class="form-group"> <button type="submit" id="stepfive" class="btn">Submit</button> </div> </div> </div> </div> </fieldset> </form> 这里是 jQuery 验证码 <script> $(document).ready(function() { $(".error").removeClass("error"); $(".next").click(function() { var form = $("#prizeRegistration"); jQuery.validator.addMethod("agreement", function(value, element) { if ($("#agreement").is(":checked")) { return true; } else { return false; } }, "Please check the box."); jQuery.validator.addMethod("declaration", function(value, element) { //var ckb_status = $("#declaration_agreement").prop('checked'); if ($("#declaration").is(":checked")) { return true; } else { return false; } }, "Please check the box."); jQuery.validator.addMethod("lettersonly", function(value, element) { return this.optional(element) || /^[a-zA-Z ]*$/.test(value); }, "Letters only please"); $.validator.addMethod('filesize', function(value, element, param) { return this.optional(element) || (element.files[0].size <= param * 1000000) }, 'File size must be less than {0} MB'); form.validate({ // ignore: [':not(checkbox:hidden)'], submitHandler: function() { $('.loaderhome').show(); form.submit(); }, focusCleanup: true, errorPlacement: function(error, element) { var name = $(element).attr("name"); error.insertAfter($("#error_" + name)); }, rules: { email: { required: true, email: true, }, publisher: { required: true, }, pbh_name: { required: true, lettersonly: true }, imprint_name: { required: true, lettersonly: true }, reg_address: { required: true, }, reg_phone: { required: true, number: true, maxlength: 10, minlength: 10 }, contact_person: { required: true, lettersonly: true }, cp_email: { required: true, email: true, }, cp_phone: { required: true, number: true, maxlength: 10, minlength: 10 }, proof: { required: true, filesize: 2 }, agreement: { required: true, }, published: { required: true, }, english: { required: true, }, book_title: { required: true }, published_date: { required: true, }, publishing_date: { // required: true }, isbn_code: { required: true, number: true, maxlength: 13, minlength: 10 }, orignal_title: { lettersonly: true }, original_lang: { lettersonly: true }, original_publisher: { lettersonly: true }, original_pub_date: { }, original_isbn_code: { number: true, maxlength: 13, minlength: 10 }, other_territory_pub: { required: true, }, territory_of_pub: { lettersonly: true }, other_territory_date_of_pub: { }, book_cover: { required: true, filesize: 2 }, ebook: { required: true, filesize: 2 }, author_name: { required: true, lettersonly: true }, author_date_of_birth: { required: true, }, author_email: { required: true, }, author_address: { required: true, }, author_proof_of_citizen: { required: true, filesize: 2 }, editor_name: { required: true, lettersonly: true }, editor_email: { required: true, email: true, }, editor_contact_number: { required: true, number: true, maxlength: 10, minlength: 10 }, declaration: { required: true, } }, }); console.log(form); if (form.valid() === true) { if ($('#step1').is(":visible")) { current_fs = $('#step1'); next_fs = $('#step2'); $('#publisher').removeClass('active'); $('#publisher').addClass('grnactive'); $('#book').addClass('active'); } else if ($('#step2').is(":visible")) { current_fs = $('#step2'); next_fs = $('#step3'); $('#book').removeClass('active'); $('#book').addClass('grnactive'); $('#author').addClass('active'); } else if ($('#step3').is(":visible")) { current_fs = $('#step3'); next_fs = $('#step4'); $('#author').removeClass('active'); $('#author').addClass('grnactive'); $('#editor').addClass('active'); } else if ($('#step4').is(":visible")) { current_fs = $('#step4'); next_fs = $('#step5'); $('#editor').removeClass('active'); $('#editor').addClass('grnactive'); $('#declaration').addClass('active'); } else if ($('#step5').is(":visible")) { current_fs = $('#step5'); next_fs = $('#step1'); $('#declaration').addClass('active'); $('#declaration').addClass('grnactive'); } next_fs.show(); current_fs.hide(); } }); $('.backBtn').click(function() { if ($('#step5').is(":visible")) { current_fs = $('#step5'); next_fs = $('#step4'); } else if ($('#step4').is(":visible")) { current_fs = $('#step4'); next_fs = $('#step3'); } else if ($('#step3').is(":visible")) { current_fs = $('#step3'); next_fs = $('#step2'); } else if ($('#step2').is(":visible")) { current_fs = $('#step2'); next_fs = $('#step1'); } next_fs.show(); current_fs.hide(); }); }); </script> 我试图更改名称,因为,id。当我们到达最后一步声明块时,它会自动添加有效类。我希望它在提交时显示错误而不检查它。但是,它仅在您单击或切换复选框时起作用。

回答 0 投票 0

如何使用 jquery 向 select2 <select> 添加更多选项?

我遇到了同样的挑战,我发现官方 select2 文档非常有用。 我试过这个 $('#selectBox').append($('').val(optionValue).text(optionText)) 但它是自动选择...

回答 1 投票 0

如何在ajax添加的元素上绑定触摸事件?

我正在为一个小的WebApp使用touchSwipe jQuery Plugin。不幸的是,它不能用于动态添加的元素(例如通过AJAX)。好吧,我看了一下代码,发现有这样的情况。$...

回答 2 投票 1

响应式文件管理器一直在处理。

我的电脑上的Responsive File Manager有问题,一切都正常,但客户端一直看到 "Processing...",就像这张图片。没有任何错误,我可以做什么?在我的电脑上,它的工作......。

回答 2 投票 -1

如何在jQuery DataTable中把一列数据做成超链接?

如何在jQuery DataTable中使一列数据成为超链接,这是我的表。 省份 地区 ...

回答 1 投票 0

数据表中的多列排序

我有一个表,它有8列。假设它们的标题是'A','B'......'H'。'H'. 我想应用多列排序,如:"A","B"...... "H"。默认视图: 案例1: 如果用户点击'A',然后将该列排序为'A'(...

回答 1 投票 0

如何使用jQuery DataTables过滤某些列数

我正在使用Datatables插件,它自动允许对所有列进行列过滤。有没有办法让我在我的HTML中对第2到第6列进行严格的过滤呢?

回答 1 投票 0

jQuery EasyUI边框布局--移除西边折叠的能力[SOLVED]。

如何删除西面面板上的 "箭头 "图标。我想防止用户折叠西边的图标,如何删除西边面板中的'箭头'图标?

回答 2 投票 0

帮助使用SimpleModal插件(JQUERY)

你好,我正在尝试使用简单模式插件工作,但当我点击链接,对话框来了,很快就走了。我只是想让一个简单的对话框运行,如http:/www....所示。

回答 3 投票 0

将几张家具的图片拼凑起来,模仿变色。

我正在为一家家具厂做网站。我们在网站上使用了很多jQuery。我想让家具的某些部分改变颜色,所以我想我会用底座家具做一个div,然后用 ...

回答 2 投票 1

应用jQuery mask不支持0作为默认占位符。

我尝试屏蔽我的手机输入。电话号码的格式必须是+380 (XX) XXX XX XX 但是这个代码做错了。这个代码是+38X (XX) XXX XX XX,所以8后面的0不是默认的。代码 HTML。

回答 1 投票 -1

jQuery lib(fancybox)样式找不到,在reactjs中导入css导致错误。

我已经安装了jquert lib FancyBox npm install @fancyappsfancybox --save,并按照官方文档操作。但是这些规则并没有应用到fancybox dom-elements上,如何应用fancybox的样式,因为...

回答 1 投票 0

使用intl-tel-input库的自动国别功能无法使用。

我已经尝试实现国际电话输入从这个github源:https:/github.comjackocnrintl-tel-input我试图做的是我需要自动选择国家的位置。我读过...

回答 1 投票 2

在grapesjs样式管理器中集成select2或任何自定义选择插件。

问题是html中默认的select元素并不好,所以我想在grapesjs的样式管理器中实现select2插件。正如你可以看到在我的fiddle中...。

回答 1 投票 0

jquery change()vs keyup()

我目前在keyup()事件上遇到问题。当我在.change()事件中使用自动完成功能时,一切工作正常。但是,仅当...

回答 2 投票 1

为什么Asp.net Core无法读取Ajax参数?

我正在使用Asp.net MVC Core和Jquery Ajax插入数据库。问题摘要我无法读取Home-Controller的Action中的参数。这意味着我可以成功执行Ajax ...

回答 1 投票 0

Wordpress jquery.countTo插件

我在使用此插件时遇到了麻烦https://github.com/mhuggins/jquery-countTo可以在HTML上很好地工作,但是当我将网站移到wordpress时,一切崩溃了。在我的函数中....

回答 1 投票 0

。getParentNode()在节点数超过1k的树中不起作用

我正在尝试向通过zTree插件显示的树添加搜索功能。如果搜索成功,则应扩展其所有父节点并突出显示节点。我正在使用core-3.5.js ...

回答 2 投票 2

jQuery遮罩默认不支持0

我尝试掩盖我的电话输入。电话号码格式必须为+380(XX)XXX XX XX,但是此代码做错了。该代码执行+ 38X(XX)XXX XX XX,因此零后八不是默认值。代码:HTML:

回答 1 投票 0

ion-rangeslider无法显示

我正在尝试在我的React应用程序中使用ion-rangeslider。但是它并没有与ui一起显示在网页上。我正在像这样componentDidMount =()=> {$(...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.