1.
$(document).ready(function(){
$(‘form‘).find("input[type=textarea], input[type=password], textarea").each(function(ev)
{
if(!$(this).val()) {
$(this).attr("placeholder", "Type your answer here");
}
});
});//获取属性How can I select an element by name with jQuery?
you can use the attribute selector
$(‘td[name=tcol1]‘) // matches exactly ‘tcol1‘
$(‘td[name^=tcol]‘) // matches those that begin with ‘tcol‘
//通过name 选择
How can I know which radio button is selected via jQuery?
To get the value of the selected radioName item of a form called ‘myForm‘:
$(‘input[name=radioName]:checked‘, ‘#myForm‘).val()//注意这条棒哒哒的选择
//判断哪个radio 被选中
使用trigger()方法模拟事件
$("#btn").trigger("click");//模拟点击http://blog.csdn.net/lijunling2008live/article/details/7457396
使用标准效果列队,举个例子,我们可以在 <div id="foo">
的 .slideUp()
和 .fadeIn()
动画之间设置800毫秒的延时:
1 |
|
//设置动画延迟
setTimeout(
function()
{
//do something special
}, 5000);
//实打实的延迟5秒
时间: 2025-01-06 19:43:09