Questions tagged «jquery»

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

3
使用jQuery查找元素的类型
在jQuery中,如果我有一个元素的引用,如何确定它是哪种元素,例如输入或下拉列表?有什么办法找出来吗? 重复: 如何确定jQuery中匹配元素的元素类型?
345 jquery 


18
jQuery.inArray(),如何正确使用它?
第一次和我一起工作,jQuery.inArray()这有点奇怪。 如果对象在数组中,它将返回0,但是Javascript中的0为false。因此,将输出以下内容:“不在数组中” var myarray = []; myarray.push("test"); if(jQuery.inArray("test", myarray)) { console.log("is in array"); } else { console.log("is NOT in array"); } 我将不得不将if语句更改为: if(jQuery.inArray("test", myarray)==0) 但这会使代码不可读。特别是对于不了解此功能的人。他们期望当“ test”在数组中时,jQuery.inArray(“ test”,myarray)为true。 所以我的问题是,为什么要这样做呢?我真的不喜欢这个。但是一定有充分的理由这样做。
345 javascript  jquery 


25
如何在Angular中使用jQuery?
谁能告诉我,如何使用jQuery的有角? class MyComponent { constructor() { // how to query the DOM element from here? } } 我知道有一些变通方法,例如预先处理DOM元素的类或ID,但我希望有一种更干净的方法。
343 jquery  angular 

9
val()不会在jQuery中触发change()
change当我使用按钮更改事件值时,我试图在文本框上触发事件,但是它不起作用。检查这个小提琴。 如果在文本框中键入内容,然后单击其他位置,change则会触发。但是,如果单击该按钮,则文本框的值将更改,但change不会触发。为什么?
342 jquery  triggers 



28
嵌入到引导模态中时,Select2不起作用
当我在引导模式下使用select2(输入)时,无法在其中输入任何内容。就像残疾吗?在模态外部select2可以正常工作。 工作示例:http : //jsfiddle.net/byJy8/1/ 代码: <!-- Modal --> <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="myModalLabel">Panel</h3> </div> <div class="modal-body" style="max-height: 800px"> <form class="form-horizontal"> <!-- Text input--> <div class="control-group"> <label class="control-label" for="vdn_number">Numer</label> <div class="controls"> <!-- seleect2 --> <input name="vdn_number" type="hidden" id="vdn_number" …


12
jQuery的更改类名
我想更改给定td标签ID的td标签的类: <td id="td_id" class="change_me"> ... 我希望能够在其他dom对象的click事件中执行此操作。如何获取TD的ID并更改其类别?
336 jquery  css 





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.