Tag: jQuery的

标准化attr(’href’)在jQuery中返回

假设我在网页wwww.example.com/foo.html上有一个链接 在Firefox中, attr(‘href’)返回’?action = run’ 在IE中,它返回’ http://www.example.com/foo.htmlhttps://stackoverflow.com/?action=run ‘ 当使用attr(’href’)时,通常会出现哪种行为(是否有任何标准?) 是否有可能让IE返回’?action = run’?

寻找一个jQuery插件从图像中选择一种颜色?

有谁知道jQuery插件让我从页面上的图像中选择一种颜色? 如果找到jPipette到目前为止,但这是复杂的方式。 在服务器端没有PHP。

jquery为query.map设置一个click语句而不是3

我有几个div设置如下: SPEECH RELIGION AND BELIEF PRESS ASSEMBLY PETITION SPEECH RELIGION AND BELIEF PRESS ASSEMBLY PETITION 我正在用jQuery.map()添加真正的答案,如下所示: var x = $(‘.answers_total’).map(function(i,v){ return $(‘div[data-answer=true]’,v).length; // return how many have data-answer=true }); 我要做的是为点击编写一个超级简洁的function。 如果我要为每个人写出来,我会这样做: var x = $(“.answers_total”).map(function(i,v) { return $(‘div[data-answer=true]’,v).length; }); clicks = 0; $(“.answer”).click(function() { jthis = this; if ( $(jthis).att(“data-attribute”) == “true” ) { clicks++; […]

jquery滑块有两个箭头

我正在寻找带有两个箭头的jquery滑块 。这是带箭头的jquery滑块 。 有没有办法下载它? 谢谢

我应该使用$(文件)

在我的Web应用程序中,我有一个带有AJAX删除/删除按钮的购物车,它会刷新购物车并显示新购物车。 代码是这样的: $(“.delBtn”).on(“click”, function(){ // Code here }); 会发生什么情况,当显示新购物车时,删除按钮将不再有效。 我现在使用以下代码: $(document).on(“click”, “.delBtn”, function(){ // Code here }); 它按预期工作,但它是最好的选择吗? 高级开发人员或专家是否认为这是错误的代码?

单击时Jquery没有任何行为

我有一个名为#wrapper的id。 我旁边有按钮。 单击该按钮时,将触发ajax调用,返回带有名为.calendarDate的类的div列表。 一切都很好, #wrapper很好。 现在我试图在.calendarDate类上有一个click事件,但它无法正常工作。 奇怪的是我应用于该类的CSS属性正常工作。 希望有人能够承认这种奇怪的行为。 按他的方式,我的调试器没有错误。 提前感谢您的回复。 干杯。 渣 我的PHP:工作得很好 Here i set my variables… while($input<$inDays){ ++$input; $test=$input." days"; if($input<0){$attribut='"avant"';}else{$attribut='"apres"';} echo '’ .date(‘Ym-d’, strtotime($test)). ”; } 我的JS: $(document).ready(function() { $(‘#wrapper’).load(‘php/calendar2.php’); $(‘.calendarDate’).click(function(){ alert(‘Whaou!’); }); }); 我的HTML:

如何在jquery中检查下拉列表中是否有一个值或没有值?

我想要做的是检查下拉列表是否有一个值或没有,然后将其设为只读? if(){ $(‘#dropdown’).attr(“disabled”, “disabled”); } L6.5 我需要禁用所有前三个下拉菜单

为什么删除最后一个孩子不起作用?

我试图删除div旧图像并使用最后一个孩子(jQuery)添加一个新图像,但它不起作用我得到一个新图像附加旧图像旁边。 这是jQuery代码 $(function() { $(‘.iconWrapper span’).click(function(e){ var kleur=$(this).attr(‘class’); switch(kleur){ case ‘color1’: $(“#div1 img:last-child”).remove(); alert($(“#div1″).html()); $(‘#div1’).append(”); break; case ‘color2’: $(“#div1 img:last-child”).remove(); $(‘#div1’).append(”); break; case ‘color3’: $(“#div1 img:last-child”).remove(); $(‘#div1’).append(”); break; } $(‘#hiddenimg’).val(kleur); e.preventDefault(); }); HTML代码:: <?php if(isset($_SESSION['img'])){ echo '’ ; } ?>

Jquery在没有队列的情况下改变hover和焦点上的输入宽度

我希望我的输入在hover或焦点时改变宽度,并在离开焦点和hover后将其更改回来。 $(document).ready(function() { $(“#tbRegex”).hover(function() { $(this).stop(true, false).animate({ width: “200px” }); }, function() { $(this).stop(true, false).animate({ width: “40px” }); }); $(“#tbRegex”).focus(function() { $(this).stop(true, false).animate({ width: “200px” }); }); $(“#tbRegex”).blur(function() { $(this).stop(true, false).animate({ width: “40px” }); }); }); #tbRegex{width:40px;} 但我不知道如何分辨焦点和hover必须留下。

jQuery – 在动态创建的菜单中更改菜单项路径的CSS

我正在使用jQuery Vertical Menu Library www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm我想完成所选路径的选择。 假设我通过以下路径浏览该菜单(在该网站上的演示中): Folder 2 > Folder 2.1 > Folder 3.1.1 > SubItem 3.1.1.1 当我点击SubItem 3.1.1.1我想要所有之前的项目(来自上面的路径)改变它们的背景。 下面的代码仅选择最顶层的项目。 如何解决? $(‘#nav > li’).click(function () { $(this).children(‘a’).css(‘background-color’, ‘red’); $(this).parents(‘ul’).each(function () { $(this).prev(‘a’).css(‘background-color’, ‘red’); }); }); 。 在那种情况下,我的代码失败了。