Questions tagged «jquery»

jQuery是一个JavaScript库,请考虑添加JavaScript标记。jQuery是一种流行的跨浏览器JavaScript库,它通过最小化浏览器之间的差异来促进文档对象模型(DOM)遍历,事件处理,动画和AJAX交互。标记为jQuery的问题应与jQuery相关,因此问题代码应使用jQuery,并且问题中至少需要与jQuery使用相关的元素。




9
TypeError:p.easing [this.easing]不是函数
当尝试使用jQuery显示div元素时,出现此错误: [23:50:35.971] TypeError: p.easing[this.easing] is not a function @ file:///D:/html5%20puzzle/jquery.js:2 相关功能是这样的: function showWithAnimation(){ console.log('animation called'); $('#popup').show(); $("#popup").css({"top": "30%", "left": "30%"}) .animate({top:(($(window).height()/2)-($('#popup') .outerHeight()/2))-70}, 1000, 'easeOutBounce') .show(); } 该函数负责显示具有跳动动画的div,但是,显示了div但没有跳动效果。 编辑: 我包括来自CDN的jQuery和jQueryUI库,如下所示(按顺序): <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script> <script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js'> </script>


2
同位素和砌体jQuery插件之间的区别[关闭]
已关闭。这个问题需要更加集中。它当前不接受答案。 想改善这个问题吗?更新问题,使其仅通过编辑此帖子来关注一个问题。 5年前关闭。 改善这个问题 我最近发现了Masonry和Isotope JQuery插件。他们似乎在功能上几乎相同,而且似乎都拥有相同的作者。我可以看到的唯一明显区别是许可证。 两者在功能方面的主要区别是什么?你为什么要使用一个?

11
jQuery select2获取选择标签的值?
朋友您好,这是我的代码: <select id='first'> <option value='1'> First </option> <option value='2'> Second </option> <option value='3'> Three </option> </select> 这是我的select2代码: $("#first").select2(); 下面是获取选定值的代码。 $("#first").select2('val'); // It returns first,second,three. 这是一个类似的文本first,second,three,我想得到1,2,3。 意味着我需要选择框的值,而不是文本。


9
jQuery-成功使用Ajax结果返回值
我有一个jQuery $ .ajax()函数的小问题。 我有一个表单,其中每次单击单选按钮或从下拉菜单中进行选择都会创建具有所选值的会话变量。 现在-我有一个下拉菜单,其中有4个选项-第一个菜单(标签为None)具有value =“”,其他具有其ID。 我要执行的操作是使用None选项(具有空白值)删除会话,并使用其他选项创建会话,但是仅当具有该特定选择名称的会话不存在时-因为所有其他选项都分配了相同的数量-只是表明选择了哪一个。 我不确定这是否有意义-但请看一下代码-也许会更清楚: $("#add_ons select").change(function() { // get current price of the addons var order_price_addon = $(".order_price_addon").text(); // get price of the clicked radio button from the rel attribute var add = $(this).children('option').attr('label'); var name = $(this).attr('name'); var val = $(this).val(); if(val == "") { …
95 jquery 


2
Chrome扩展程序如何将数据从内容脚本发送到popup.html
我知道这个问题已经在很多帖子中问过了,但老实说我不明白。我不熟悉JavaScript,Chrome扩展程序和其他所有功能,并且已经完成了此类课程。因此,我需要制作一个可以使用跨域请求在任何给定页面上计算DOM对象的插件。到目前为止,我已经可以使用Chrome Extension API来实现这一目标。现在的问题是我需要从contentScript.js文件在popup.html页面上显示数据。我不知道该怎么做,我已经尝试阅读文档,但是用chrome发送消息我只是不明白该怎么做。 以下是到目前为止的代码。 manifest.json { "manifest_version":2, "name":"Dom Reader", "description":"Counts Dom Objects", "version":"1.0", "page_action": { "default_icon":"icon.png", "default_title":"Dom Reader", "default_popup":"popup.html" }, "background":{ "scripts":["eventPage.js"], "persistent":false }, "content_scripts":[ { "matches":["http://pluralsight.com/training/Courses/*", "http://pluralsight.com/training/Authors/Details/*", "https://www.youtube.com/user/*", "https://sites.google.com/site/*", "http://127.0.0.1:3667/popup.html"], "js":["domReader_cs.js","jquery-1.10.2.js"] //"css":["pluralsight_cs.css"] } ], "permissions":[ "tabs", "http://pluralsight.com/*", "http://youtube.com/*", "https://sites.google.com/*", "http://127.0.0.1:3667/*" ] popup.html <!doctype html> <html> <title> Dom Reader </title> …

11
如何使用JavaScript展开和折叠<div>?
我已经在我的网站上创建了一个列表。该列表由一个foreach循环创建,该循环使用我数据库中的信息构建。每个项目都是一个包含不同部分的容器,因此这不是像1、2、3 ...这样的列表。我列出的是重复的部分以及相关信息。在每个部分中都有一个小节。常规构建如下: &lt;div&gt; &lt;fieldset class="majorpoints" onclick="majorpointsexpand($(this).find('legend').innerHTML)"&gt; &lt;legend class="majorpointslegend"&gt;Expand&lt;/legend&gt; &lt;div style="display:none" &gt; &lt;ul&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; 因此,我尝试使用onclick =“ majorpointsexpand($(this).find('legend')。innerHTML)”调用函数 我尝试操作的div默认情况下为style =“ display:none”,我想使用JavaScript使其在点击时可见。 在这种情况下,“ $(this).find('legend')。innerHTML”试图传递“ Expand”作为函数中的参数。 这是JavaScript: function majorpointsexpand(expand) { if (expand == "Expand") { document.write.$(this).find('div').style = "display:inherit"; document.write.$(this).find('legend').innerHTML = "Collapse"; } else { document.write.$(this).find('div').style = "display:none"; document.write.$(this).find('legend').innerHTML = "Expand"; …


13
如何在当前日期之前30天获得?
我有一个开始日历输入框和一个结束日历输入框。我们希望将当前日期之前30天的默认开始日历输入框和当前日期作为结束日历输入框的默认值。这是我的约会变量。 var today = new Date(), dd = today.getDate(), mm = today.getMonth(), yyyy = today.getFullYear(), month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October" "November", "December"], startdate = month[mm] + ", " + yyyy.toString(); 结束日期将类似于以下内容:var enddate = startdate - 30;显然,这行不通。 因此,如果当前日期为2011年12月30日,则希望开始日期为2011年12月1日。 编辑:我的问题得到了回答...有点。Date.today();和Date.today().add(-30);工作,但我需要日期格式为January 13, 2012。不Fri Jan 13 2012 …


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.