jQuery
共 4 篇文章
select通用实时排序
function generalSelectSort(selector_id,value,text) { var first = ''; if ($("#"+selector_id).children("option").length === 0) { $("#operation_selector").append('<option value="' + value + '">' + text + '</option>'); first = text; } var appended = 0; $("#"+selector_id).children("option").each(functio…
2013-07-26 16:37 · jQuery · Javascript
jquery中val,text,html,attr的区别
1.html() 类似于javascript众的InnerHtml属性,可以用来读取或者设置某个元素中的HTML内容 例如: Java代码 1. <p><strong>Hello world</strong></p> 2. 3. alert($('p').html()); <p><strong>Hello world</strong></p> alert($('p').html()); 返回: Java代码 1. <strong>Hello world</strong> <strong>Hello world</strong> 2.text() 类似于javascript众的InnerTex…
2012-03-29 14:33 · jQuery
[从jQuery看JavaScript]-匿名函数与闭包(Anonymous Function and Closure)(转)
jQuery片段: (function(){ //这里忽略jQuery所有实现 })(); 半年前初次接触jQuery的时候,我也像其他人一样很兴奋地想看看源码是什么样的。然而,在看到源码的第一眼,我就迷糊了。为什么只有一个匿名函数又没看到运行(当然是运行了……),就能有jQuery这么个函数库了?于是,我抱着疑问来到CSDN。结果相信现在很多人都很清楚了(因为在我之后也不乏来者,呵呵~)。当一个匿名函数被括起来,然后再在后面加一个括号,这个匿名函数就能立即运行起来!真神奇哦! 嘿嘿!胡闹到此为止。在这一节,我们碰到的jQuery片段是一组立即运行的匿名函数。而这种用法在论坛上也曾引起过激辩…
2012-03-13 16:43 · jQuery