gpt4 book ai didi

javascript - jQuery 多操作按钮

转载 作者:行者123 更新时间:2023-11-30 23:41:57 25 4
gpt4 key购买 nike

I have a button. I click 3 times on this button. I want show a yellow box on first click, and hide the yellow box and show a blue box instant of that on second click , and hide blue box and show a red box instant of blue box on third click.

用 jQuery 可以吗?怎么办?

最佳答案

您可以使用toggle()方法,该方法采用多个函数作为参数,并为每次点击执行一个函数(按顺序)

示例位于http://www.jsfiddle.net/4qsq4/

请记住,这是一个有点暴力的解决方案。如果您可以提供一些 HTML 结构,我们可能会更加自动化。

关于javascript - jQuery 多操作按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4303455/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com