我想在選擇單選按鈕時隱藏div。如何在輸入無線電廣播時選擇隱藏div javascript angularjs
<div class="col-md-3">
<input type="radio" name="service_option" ng-model="service_option" value="adhoc" id="service_option">Adhoc <br/>
<input type="radio" name="service_option" ng-model="service_option" value="weekly" id="service_option">Weekly
<div class="product-noselected-message" style="font-size: 10px; color: red">Please choose an option</div>
</div>
<div class="col-md-3">
<button class="btn btn-default" ng-click="getReservationDetails('lg', packageSlot)"> Book Now </button>
</div>
在我的代碼中,如果選擇單選按鈕,我希望div class = product-noselected-message被隱藏。
這是西隧我有我的javascript此刻
$scope.getReservationDetails = function(size, packageSlot) {
var service_option;
if($('input[name=service_option]:checked')) {
service_option = $('input[name=service_option]:checked').val();
}
if (service_option!= null) {
$rootScope.date = new Date();
console.log($rootScope.date);
$rootScope.singlePackageSlot = packageSlot;
$rootScope.locationName = $scope.cleaningServiceLocation.name;
modalInstance = $modal.open({
templateUrl: 'views/cleaning_services/register_event.html',
controller: 'CleaningServicesCancelCtrl',
size: size
});
}
else {
$('.product-noselected-message').html('Please select an option');
}
$('#service_option').on('checked', function() {
$('.product-noselected-message').addClass('hidden');
});
但它不工作西隧我該怎麼辦?
http://plnkr.co/edit/GVYuI47TKlAVqkVDUDOq
加引導的標籤,因爲金斯利西蒙也沒顧上添加它,但預期應答者一個猜測。 – 2015-04-04 14:32:29