Search code examples
htmlangularjsng-hideangularjs-ng-show

Show another Div when I clicked the button on the Previous Div


I have two <div> in my html file. The first <div> contains a button that when I click should show the other div and would hide the first one. My code is something like this:

<div class="container" ng-hide="showme">
    <p>Quick</p>
    <button class="button" ng-click="showme=true" >Edit</button>
</div>
<div class="container" ng-show="showme">
    <p>Congratulations!</p>
</div>

How can I possibly do that?


Solution

  • It's easier with jquery just write

        $(document).ready(function(){
            $("#Button-id").click(function(){
                $(this).parent().css("display","none");
                $(this).parent().next().css("display","block");
            });
        });
    

    https://jsfiddle.net/sy1x1xm9/