sách gpt4 ăn đã đi

jquery - 结束()函数

In lại Tác giả: Walker 123 更新时间:2023-12-01 00:13:02 27 4
mua khóa gpt4 giày nike

jQuery 中的 end() 函数将元素集恢复到上次破坏性更改之前的状态,因此我可以看到它应该如何使用,但我已经看到了一些代码示例,例如:on alistapart (可能来自旧版本的 jQuery - 文章来自 2006 年),它以 .end() 结束每条语句。例如:

$( 'form.cmxform' ).hide().end();
  • 这有什么影响吗?
  • 这也是我应该做的事情吗?
  • 上面的代码返回什么?

câu trả lời hay nhất

那个 end() 没有做任何事情。这样的编码是没有意义的。它将返回 $('#myBox') ——这个例子非常糟糕。更有趣的是这样的:

$('#myBox').show ().children ('.myClass').hide ().end ().blink ();

这将显示myBox,隐藏指定的子项,然后闪烁该框。这里还有更多有趣的例子:

http://simonwillison.net/2007/Aug/15/jquery/

如:

$('form#login')
// hide all the labels inside the form with the 'optional' class
.find('label.optional').hide().end()
// add a red border to any password fields in the form
.find('input:password').css('border', '1px solid red').end()
// add a submit handler to the form
.submit(function(){
return confirm('Are you sure you want to submit?');
});

关于jquery - 结束()函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/165729/

27 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress