🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

tw-address-input

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tw-address-input

Taiwan address input component

1.0.7
latest
Source
npm
Version published
Weekly downloads
3
-25%
Maintainers
1
Weekly downloads
 
Created
Source

tw-address-input

published coverage npm npm GitHub issues license

NPM

A simple Taiwan address input WebComponent.

English | 中文

demo image

Install

$ npm install tw-address-input

Syntax

<script src="tw-address.js"></script>

<form action="#" method="POST">
    <tw-address name="bill-address"></tw-address>
    <input type="submit" value="submit" />
</form>

Demo page

The demo page: https://yishiashia.github.io/address.html

Usage

  • name
  • value

Attributes

name

String typs. The name of input, it would be the POST parameter name.

value ( getter )

You can get the value of address input component by javascript, for example:

const addrElement = document.querySelector('tw-address')

console.log(addrElement.value)
/*
  It will output:
  {
    zip: '220',
    city: '新北市',
    town: '板橋區',
    address: '漢生東路83巷1號'
  }
 */

Event

change event

When user fill an address, a change event will be dispatch, and you can bind an event listener to handle it:

let addrElement = document.querySelector('tw-address')

addrElement.addEventListener('change', function(option) {
  console.log(option.detail)
  /*
    output example:
      {
        zip: "220",
        city: "新北市",
        town: "板橋區",
        address: "漢生東路83巷1號"
      }
   */
})

Keywords

Taiwan

FAQs

Package last updated on 20 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts