一个武将 发表于 2013-2-7 19:28:06

jquery 开发中常用的代码

下面的代码都从自己手头中的项目中整理。比较乱,没有时间整理啊。
ajax:
$.ajax({    type:"post",    url:"complexReport.do?method=getHySelectHtml",    async: false,    data:{jclx:encodeURIComponent(lx)},    success:function(data){      //alert(data)      $("#sshytd").html(data);    } });
事件绑定,jquery支持当前给页面中不存在的dom元素添加事件。比如:该dom元素是ajax加载的。
$("#sumRadio").live("click",function(){   window.location.href="sumReport.do?method=showSumReportPage&path=sumReportPage&jclx=dbswr";      });
jquery的选择器示例和选取元素属性值的示例:
$("select option:selected").text()) //name 为checkbox name function CheckAll(e,name){   var checked = $(e).attr('checked');      $(e).parents('table').find('input').each(function(){         if(!$(this).attr("disabled")){            $(this).attr("checked",checked);         }    }); }//下面的代码是给一个表格的某几列添加click时间,并且对
jquery的工具函数:
$.trim(content)
页: [1]
查看完整版本: jquery 开发中常用的代码