Skip to content

Commit

Permalink
Inline demo update
Browse files Browse the repository at this point in the history
  • Loading branch information
MacTheZazou committed Mar 8, 2017
1 parent 71744f6 commit c4985fc
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/koada-os/paper-input-username)

##<paper-input-username>
# <paper-input-username>

Material design: Text fields with username check system

Expand All @@ -9,6 +9,7 @@ Material design: Text fields with username check system
Example:

<!--
```
<custom-element-demo>
<template>
Expand All @@ -17,19 +18,22 @@ Example:
</template>
</custom-element-demo>
```
-->

```html
<paper-input-username id="validInput" minlength="3" min-error-message="Your username must be longer." label="Valid Username" allowed-pattern="[a-zA-Z0-9]"></paper-input-username>
<paper-input-username id="failInput" label="Conflict Username" allowed-pattern="[a-zA-Z]"></paper-input-username>

var validInput = document.getElementById('validInput');
var failInput = document.getElementById('failInput')
var customFailInput = document.getElementById('customFailInput')
validInput.addEventListener('usernameChanged', function(e,w) {
console.log(e,w);
validInput.usernameValid();
});
failInput.addEventListener('usernameChanged', function() {
failInput.usernameInvalid('The username already exists');
});
<script>
var validInput = document.getElementById('validInput');
var failInput = document.getElementById('failInput')
var customFailInput = document.getElementById('customFailInput')
validInput.addEventListener('usernameChanged', function(e,w) {
console.log(e,w);
validInput.usernameValid();
});
failInput.addEventListener('usernameChanged', function() {
failInput.usernameInvalid('The username already exists');
});
</script>
```

0 comments on commit c4985fc

Please sign in to comment.