如何正确使用href=“#someID”?
基本上,我想要一个链接列表,其中每个链接将显示一个 div。我已经设置好了一切,以便可以正常工作,但我只是不知道哪些事件被触发以及以什么顺序被触发。我想添加功能,以便当显示这些 div 之一时,运行 javascript。但到目前为止,使用如下代码:
在实际显示 div 之前调用 some_script() 。这对我来说毫无用处,因为我试图在显示 div 后让某个输入框成为焦点。
谁能告诉我哪些 jquery 事件被触发,或者我可以使用 jquery 事件,以便我可以在 div 显示给用户后运行 some_script() ?
Basically, I want to have a list of links, where each link will show a div. I have everything set up so that this works, but I just have no idea as to which events are getting fired, and in what order. I want to add functionality so that when one of these divs is shown, javascript is run. But so far using code such as this:
<a href="#div1" onclick="some_script()" />
calls the some_script() before it actually shows the div. Which is useless to me, since I am trying to get a certain input box to be focused, after showing the div.
Can anyone tell me which jquery events get fired, or and jquery events that I can use so that I can run some_script() after the div is shown to the user?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用类似的内容
此链接应该可以帮助您开始使用 jQuery。 http://docs.jquery.com/Main_Page
You can use something like this
This link should get you started with jQuery. http://docs.jquery.com/Main_Page
如果我正确理解您的要求:
HTML
CSS
JavaScript
jsFiddle 演示:http://jsfiddle.net/byuPL/
If I understood your requirements correctly:
HTML
CSS
JavaScript
jsFiddle demo: http://jsfiddle.net/byuPL/