jQuery显示下一个父div

den*_*icz 4 jquery jquery-selectors

我有以下HTML标记:

<div id="step1" class="step">
                    <h1>Enter code</h1>
                    <p><input type="text" value="<%= @groupCode %>" name="group_code" class="span3" />
                        <a class="btn btn-primary btn-medium">
                            Next &raquo;
                        </a>
                    </p>
                </div>
                <div id="step2" class="step" style="display: none">
                    <p>Hello World</p>
                </div>
Run Code Online (Sandbox Code Playgroud)

单击链接(.btn)后,我需要显示下一个父div(#step2).我将其设计为注册过程,因此将有多个父div(所有以step {:id}命名)

任何帮助深表感谢!

Rio*_*ams 8

你应该可以使用类似的东西:

//This should access the parent (step1), then the next element (step2)
$(this).parent().next()
Run Code Online (Sandbox Code Playgroud)