这是我的js代码:
如何显示一个div被点击一个特定的按钮时,
我想点击第一个按钮来调用一个新的类,它的工作原理,但是,每一个 按钮做同样的工作。当我点击第二个按钮时,这也叫 一个新的class.please帮我解决这个问题。
<script> $(document).ready(function(){ $("button").click(function(){ /*button click event*/ $(".new").toggle(); /*new class calling */ }); }); </script>
这是我的html代码:
<button>first</button><br> <button>second</button><br> <button>third</button><br> <div class="new" style = "display: none;">hi.</div> <!--i need to call only this class--> <div class="old"><a href="www.google.com">hello.</a></div>
谢谢大家解决这个...... –
我有多个按钮,并在网页中单击功能,当我点击这个第一个按钮(上图)和触发事件occurs..this作品,但是当我点击其他按钮调用触发事件......请帮助我如何解决这个... –
你需要给不同的ID的不同按钮 –