New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jb-input

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jb-input

input web component

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39
decreased by-80.3%
Maintainers
1
Weekly downloads
 
Created
Source

jb-input

install

npm install jb-input
<jb-input value="defualt value"></jb-input>

instructions

install

npm i jb-input

in one of your js in page

import 'jb-input';

in your html or jsx

<jb-input class="" label="لیبل" message="متن ثابت زیر کادر متن"></jb-input>
### get/set value

```js
const inputValue = document.getElementByTagName('jb-input').value;
document.getElementByTagName('jb-input').value = "new string";

events

document.getElementByTagName('jb-input').addEventListener('change',(event)=>{console.log(event.target.value)});

set validation

you can set validation to your input:

    titleInput.validationList = [
        {
            validator: /.{3}/g,
            message: 'عنوان حداقل باید سه کاکتر طول داشته باشد'
        },
        #you can use function as a validator too
        {
            validator: (inputedText)=>{return inputedText == "سلام"},
            message: 'شما تنها میتوانید عبارت سلام را وارد کنید'
        },
    ]

check validation

you can check is image input value meet your validation standad by dom.triggerInputValidation(showError) the showError parameter is optional and its defualt is true but you cant set it false so if value is invalid component dont react and show error to user and just return validation object.
in change event we have detail object you can access it by event.detail.isValid so you can see in new value is a valid value or not this way is really useful when you dont access to DOM directly like what we have in js frameworks.

other attribute

atribute namedescription
namename you want to set to actual input element <jb-input name="username"></jb-input>
messagein botton of input we show small message for example "user name must be at least 5 char"
autocompleteset autocomplete directly into dom element in case you need it

Keywords

FAQs

Package last updated on 31 Aug 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc