Avatar of Seven price
Seven priceFlag for United States of America

asked on 

hide value checkbox

http://jsfiddle.net/sevensnake/nvrwjd29/

when I type a value in the textbox and check the checkbox I want to remove and when I select the dropdown value then uncheck I want to remove the value.
So I can have either or. Either the textbox value or the select box.
JavaScriptjQuery

Avatar of undefined
Last Comment
Seven price
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Seven price
Seven price
Flag of United States of America image

ASKER

looks great. it works in fiddle but watch does not work after load.  can this be a ng-click. may work out better for me.
Here's the version with the ng-click: http://jsfiddle.net/AlexCode/nvrwjd29/4/
var app = angular.module("MyApp", []);

app.controller("mainController", function ($scope) {

    $scope.chkChanged = function(){
        if(!$scope.a) return;
        
        if($scope.mymodel){
            delete $scope.a.select;
        } else {
            delete $scope.a.text;
        }
    };
});

Open in new window

The difference is not that big and actually like this you keep one watch out of the digest cycle :)
Avatar of Seven price
Seven price
Flag of United States of America image

ASKER

tks
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo