AngularJS editable drop-down options box

Source: Internet
Author: User

Feature Description:

  The component combines the text box and the drop-down box, when you click the rightmost drop-down button to implement the function of the dropdown box selection, and when you select the text box, implement the text box input function. Set the text box and drop-down box as the Name property he automatically passes the value of the corresponding drop-down box into the background, and the value of the text box does not pass, and when you do the text box, it passes the value of the text box into the background and the value of the drop-down box does not pass.


Editable drop-down options box

Any1

1.html Code
1 <!DOCTYPE HTML>2 <HTMLNg-app= "MyApp">3     <Head>4         <MetaCharSet= "UTF-8">5         <title>Editable drop-down options box</title>6         <Scriptsrc=".. /.. /js/angular.min.js "type= "Text/javascript"CharSet= "Utf-8"></Script>7         <Scriptsrc=".. /js/edit_sel.js "type= "Text/javascript"CharSet= "Utf-8"></Script>8         <Linkrel= "stylesheet"type= "Text/css"href= "Edit_sel.css"/>9     </Head>Ten      One     <BodyNg-controller= "Mycon"> A         <Selectclass= "SEL"name= "Search"Ng-focus= "Fochange (FLT1)"Ng-model= "FLT1"Ng-change= "Ftl1change (FLT1)"Ng-focus= "FOC"> -             <optionvalue=""></option> -             <optionvalue= "any">Any</option> the             <optionvalue= "1"style= "Display:none;">1</option> -         </Select>* -         <inputclass= "INP"maxlength= "4"type= "text"Required= "Required"  - Ng-blur= "Chknumber (fltNo1)"Ng-model= "FltNo1"Ng-change= "Fltno1change (fltNo1)" /> +             <FontColor= "Red">&nbsp;*</Font> -             <spanNg-model= "Tips">&nbsp;{{Tips}}</span> +     </Body> A </HTML>
2.css Style Introduction
1 . Sel{2 width:1.5%;3 position:relative;4  Left:11.5%;5 Height:21px;6}7 8 . INP{9 width:10%;Ten position:relative; One  Left:-20px; A}

3. Editable text box drop-down options for JS code implementation
Angular.module ("MyApp", []). Controller ("Mycon",function($scope) {varVM =$scope; //Drop- down box Change event$scope. ftl1change=function(FLT1) {//Console.log (FLT1);        if(vm.flt1=== "" | | vm.flt1==NULL) {Vm.fltno1=""; }Else{vm.fltno1= "any";        }            }; //text Box input Change event$scope. Fltno1change =function(fltNo1) {VM.FLT1=FltNo1;        }; //Drop- down box Focus eventVm.fochange =function(FLT1) {VM.FLT1= "1";        }; //verify whether the input data is valid$scope. chknumber=function(eletext) {varValue =Eletext;  for(vari=0;i<value.length;i++)                {                     if(Value.charat (i) > "9" | | Value.charat (i) < "0") {vm.tips= "Enter illegal characters!" ";                            Eletext.focus ();  Break; }              }    };});/*//HTML native onblur event checksum <input type= "text" id= "D1" onblur= "Chknumber (This)"/> function Chknumber (eletext)              {var value =eletext.value;              var len =value.length;                     for (Var i=0;i<len;i++) {if (Value.charat (i) > "9" | | Value.charat (i) < "0")                            {Alert ("contains non-numeric characters");                            Eletext.focus ();                     Break }              }       }       */

AngularJS editable drop-down options box

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.