###前提・実現したいこと
セレクトメニューから下記の東京、その他関東地区を選択し、それらを
外した時、divの値が空になるのでこちらをもとの旅行地を選択を表示させたいです。
###該当のソースコード
html
1<ul> 2 <li style="list-style: none"> 3 <div class="sel1" ng-bind="location">旅行地を選択</div> 4 <select class="op1" multiple size="2" ng-model="location"> 5 <option value="" disabled>旅行地を選択</option> 6 <option value="東京">東京</option> 7 <option value="その他関東地区">その他関東地区</option> 8 </select> 9 </li> 10<ul>
css
1ul { 2 position: relative; 3 padding: 0; 4 display: block; 5 z-index: 1; 6 vertical-align: top; 7 margin: 0 0 10px; 8} 9 10li { 11 position: relative; 12} 13.sel1{ 14 margin: 0 auto; 15 margin-bottom: 20px; 16 width:90%; 17 display: block; 18 overflow: hidden; 19 text-overflow: ellipsis; 20 font-size: 14px; 21 white-space: nowrap; 22 box-sizing: border-box; 23 border: solid 1px #888888; 24 border-radius: 5px; 25 background-size: auto 30%; 26 padding: 4px 25px 4px 5px; 27 line-height: 20px; 28 height: 30px; 29 color: #3E3939; 30} 31.op1{ 32 -moz-appearance: none; 33 -webkit-appearance: none; 34 appearance: none; 35 border-radius: 0; 36 border: 0; 37 margin: 0 5%; 38 padding: 0; 39 background: none transparent; 40 vertical-align: middle; 41 font-size: inherit; 42 color: inherit; 43 box-sizing: content-box; 44 width: 90%; 45 height: 30px; 46 overflow: hidden; 47 position: absolute; 48 top: 0; 49 opacity: 0; 50} 51
AngularJS
1<script> 2angular.module('App', []) 3 .controller('formController', ['$scope', function($scope) { 4 $scope.location = '勤務地を選択'; 5 }]); 6</script>
###js
出来ればjqueryを使いたくないので、Angularでできるならそちらの方法も教えてほしいです。
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/11/01 05:12
2016/11/01 10:12
2016/11/02 02:55
2016/11/02 03:51