当我用HTML中的按钮单击选择其他div时,如何隐藏一个div代码。 [英] How to hide one div code when I select other div with button click in HTML.

查看:428
本文介绍了当我用HTML中的按钮单击选择其他div时,如何隐藏一个div代码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了最初隐藏内容的代码。每当我点击按钮时,它就会显示数据内容。以类似的方式,我创建了与我提到的相同行为的其他按钮。现在问题是当我一个接一个地点击这些按钮时,这些按钮的内容显示在页面上。当我点击时我需要隐藏一个按钮内容另一个按钮。你能帮我解决这个问题吗?



我尝试过:



HTML:

Button1:

I have written the code to hide the content initially. whenever I click on the button its displaying that content of data. In similar way I created other button with same behavior as I mentioned.Now the problem is when I click on those buttons one after another, the content of those buttons are displaying on the page.I need to hide one button content when I click on the other button. Can u plz help me to fix this??

What I have tried:

HTML:
Button1:

<button type="button" value="click1"  ng-click="show=!show"><font color="white">Display1</font></button>




<div  ng-show="show">
Helloo hyderabad.
</div>




Button2:
<pre>  <button type="button" value="click1"  ng-click="show1=!show1"><font color="white">Display1</font></button>




<div  ng-show="show1">
Helloo hyderabad.
</div>



JS:


JS:

app.controller('MainCtrl', function ($scope) {
    $scope.show = false; // Hide it initially 


});




app.controller('MainCtrl', function ($scope) {
    $scope.show1 = false; // Hide it initially 


});

推荐答案

范围){


scope.show = false; //最初隐藏


});
scope.show = false; // Hide it initially });




app.controller('MainCtrl', function (


范围){


这篇关于当我用HTML中的按钮单击选择其他div时,如何隐藏一个div代码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆