Jquery小知识
2015-07-15 23:16
567 查看
1.
youcanusetheattributeselector
TogetthevalueoftheselectedradioNameitemofaformcalled'myForm':
//判断哪个radio被选中[/code]
使用标准效果列队,举个例子,我们可以在
//设置动画延迟
info+id是一个select的id
val=$('#info'+id).val();
varselect='#info'+id+'option:selected';
varnewcontent=$(select).text();
//取得select选中的optionvalue和text
$(document).ready(function(){ $('form').find("input[type=textarea],input[type=password],textarea").each(function(ev) { if(!$(this).val()){ $(this).attr("placeholder","Typeyouranswerhere"); } }); }); //获取属性 HowcanIselectanelementbynamewithjQuery?
youcanusetheattributeselector
$('td[name=tcol1]')//matchesexactly'tcol1' $('td[name^=tcol]')//matchesthosethatbeginwith'tcol'//通过name选择[/code]
HowcanIknowwhichradiobuttonisselectedviajQuery?
TogetthevalueoftheselectedradioNameitemofaformcalled'myForm':
[code]$('input[name=radioName]:checked','#myForm').val()//注意这条棒哒哒的选择
//判断哪个radio被选中[/code]
使用trigger()方法模拟事件
$("#btn").trigger("click");
//模拟点击http://blog.csdn.net/lijunling2008live/article/details/7457396
使用标准效果列队,举个例子,我们可以在
<divid="foo">的
.slideUp()和
.fadeIn()动画之间设置800毫秒的延时:
1 | $('#foo').slideUp(300).delay(800).fadeIn(400); |
info+id是一个select的id
val=$('#info'+id).val();
varselect='#info'+id+'option:selected';
varnewcontent=$(select).text();
//取得select选中的optionvalue和text
setTimeout(
function()
{
//dosomethingspecial
},5000);
//实打实的延迟5秒
绑定
相关文章推荐
- ASP.NET 异步Web API + jQuery Ajax 文件上传代码小析
- jquery 连接在div中显示
- jQuery提交form表单
- jQuery提交form表单
- jQuery提交form表单
- jquery中的$(function(){});函数
- jQuery提取元数据Metadata插件
- jQuery使用技巧
- Jquery 插件集合
- 黑马day18 jquery高级特性&ajax的$.ajax()方法
- 黑马day18 jquery高级特性&Ajax的load方法
- 在jquery中用下拉框列表显示默认的值
- jQuery--自定义插件
- MVC注册验证:js方法(jQuery)
- Java程序猿JavaScript学习笔记(14——扩大jQuery UI)
- jsonp+jquery示例代码,jsonp是什么?看完了还不会我就给你跪了.....
- struts2中用jquery、ajax实现下拉框的级联
- jquery动态创建表格
- 自定义jQuery插件Step by Step
- JQuery的animate