Tag: jquery click event

返回Checkbox值以及如何添加复选框的值

需要获取checkbox的值,需要通过添加所有值而不是存储在array.how中来存储在single variable 。我应该得到它。 在这里我的小提琴和我的jquery function getCheck() { $(‘ul.addon > li :checked’).each(function() { allVals.push($(this).val()); }); return allVals; } $(function() { $(‘ul.addon > li > input’).click(getCheck); getCheck(); $(allVals).each(function(){ addon+=parseInt(allVals); $(‘#op’).html(addon); }); }); 这里allvals数组包含复选框1,2,1,1,3的值 现在我需要添加这些值并移动到addon变量,如1 + 2 + 1 + 1 + 3 = 8 如果我取消选中该复选框,则必须使用该值,我尽力了,但我无法得到它…… :(提前谢谢

如何使用克隆的jQuery对象为div内容中的每个id属性添加增量值

很难确定如何使用克隆的jQuery对象为div内容中的每个id属性添加增量值。 http://jsfiddle.net/hvK8d/ ===================== HTML ===================== Resume Letter of Recommendation Other Remove plus one ===================== JQUERY ===================== //Cloning upload file control $(‘.remove’).live(‘click’, function () { if (confirm(“Are you sure you wish to remove this item?”)) { $(this).parent().slideUp(‘fast’, function () { $(this).remove(); }); } return false; }); $(‘.plus’).click(function () { console.log(‘cloning’); var divCloned = $(‘.upload-file-container:first’).clone(); divCloned.hide().insertAfter(‘.upload-file-container:last’).slideDown(‘fast’); return […]

你能点击’jQuery中加载的内容吗?

我正在尝试创建一个页面,其中示例div是可点击的,因为它将在下面。 但是我试图这样做,如果用户点击徽标,它将使用加载重新加载原始内容。 发生此负载后,是否可以“点击”已加载的 ? 我正在尝试这一点,当点击file.php中的加载的 时,它无法提醒 Example $(document).ready(function() { $(“#example”).click(function(){ alert(“You clicked me!”); }); $(“#logo”).click(function(){ $(“#main”).load(“file.php”); }); }); This is content. file.php包含 This is loaded content that can’t be clicked?

在jQuery中更改DOM后,Click事件未触发

我正在尝试在HTML页面中编写ADD&DELETE按钮来删除或添加页面中的图像代码。 DELETE按钮将删除按钮前的第一个图像。 ADD按钮将新图像插入HTML页面,删除按钮将插入图像。 代码工作正常:单击DELETE按钮时删除图像,单击ADD按钮时插入图像。 问题是:单击ADD按钮后插入的删除按钮不起作用。 因此,如果单击“添加”按钮,然后单击“删除”按钮,图像将不会隐藏; click事件未触发。 这是代码: $(document).ready(function(){ $(‘.img-post input’).after(‘Delete’); $(“.img-post button”).click(function() { $(this).prev().prev().remove(); $(this).prev().remove(); $(this).remove(); }); $(“.add-img button”).click(function() { $(‘Delete’).appendTo(‘.img-post’); }); }); Add image

Jquery在A Href上创建双击事件

伙计们可以使用jquery为a href创建双击事件

jQuery – 如何使.on事件为动态创建的HTML工作?

阅读最新的jQuery 1.x库的新规范,它说使用.on来附加适用于动态创建的jQuery元素的事件,但是,我似乎无法完成这项工作。 在我的$(document).ready函数中,我有以下内容: jQuery的: $(“.dropdown”).on(“click”, function(event) { event.preventDefault(); var type = $(this).text() == ‘[ Read more… ]’ ? ‘expand’ : ‘collapse’; var theDiv = type == ‘expand’ ? $(this).parent().next(“div”) : $(this).parent().prev(“div”); var theId = $(this).attr(“id”); $(this).parent().remove(); var vText = theId == ‘reqMat’ ? ‘Every candidate is required to submit a headshot and candidate statement.’ : […]

条件禁用/重新启用jQuery单击事件

我在链接上禁用和重新启用点击事件时出现问题。 设置是连续4列,每列包含链接和隐藏内容框。 单击链接时,它会展开行并显示特定于该列的内容框。 单击链接并展开行后,所有其他链接将逐渐淡出。 然后,您将重新单击打开的链接以关闭该行并取消淡化其他链接。 我已经设置了这个场景的工作小提琴,应该有助于解释它…… http://jsfiddle.net/r8K78/2/ $(‘.open-box’).click(function(event) { event.preventDefault(); var $list_row = $(this).parents(‘.row’), $column_box = $(this).parent(‘.column’).find(‘.box’); if ( $(this).is(‘.open’) ) { $(this).removeClass(‘open’); $list_row.stop().animate({ ‘padding-bottom’: 0 }, 100).removeClass(‘expanded’); // hide the content box $column_box.hide(); // find all links and fade them in $(‘.box-list’).find(‘.box-link’).fadeTo(100, 1).addClass(‘open-box’); } else { $(this).addClass(‘open’); $list_row.stop().animate({ ‘padding-bottom’: 200 }, 100, function() { […]

jQuery:如何检测是否未单击元素?

我想知道是否可以检测是否未点击元素。 这是我的代码: $(“#mpElement”).myFeature({ ……… ……… ……… afterDo: function() { // This if-else statement has to go inside “when not clicked” condition. // Not sure how to do this… if($(“.myButton”).last().hasClass(“selected”)) { $(“.myButton”).first().addClass(“selected”); $(“.myButton”).last().removeClass(“selected”); } else { $(“.selected”).removeClass(“selected”).next().addClass(“selected”); } $(“.myButton”).on(“click”, function(){ $(“.myButton”).removeClass(“selected”); $(this).closest(“.myButton”).addClass(“selected”); }); } }); 您会注意到$(“。myButton”)。on(“click”,function(){用于检测点击事件。我想在未点击条件时将if-else语句置于此函数之上。不确定如何做这个。

jQuery click()事件catch-all?

当用户点击屏幕上的任何位置时,我们在屏幕上显示一个我想要隐藏的框,包括正文,锚点,div,按钮等…是否有一个选择器可以为我处理这个? 或者是$(‘body, a, div, input’).click() ?

jQuery .click()函数自动调用

我使用jQuery在按钮上设置了一个事件监听器,由于某种原因,在没有单击按钮的情况下调用click监听器中的函数。 我知道通常函数在侦听器中是匿名的,但它不能用作匿名函数。 我调用的函数也必须接受参数,这就是为什么我认为我不能只调用函数的引用。 有关如何解决函数调用问题的任何想法,如果没有点击甚至注册,仍然将必要的参数传递给函数? $(‘#keep-both’).click(keepBothFiles(file, progress, audioSrc)); 调用此函数 function keepBothFiles(file, progress, audioSrc) { … … }