1.1.0 • Published 3 years ago

formless-button v1.1.0

Weekly downloads
26
License
ISC
Repository
github
Last release
3 years ago

Formless Button

Handle button click as form submit.

Installation

npm i formless-button

Requirements

In order to work properly, you have to add meta tag with CSRF token into <head>

<meta name="csrf-token" content="AAABBBCCCDDDEEE">

For Laravel:

<meta name="csrf-token" content="{{ csrf_token() }}">

Usage

In your JS file just import FormlessButton.js, for example

import FormlessButton from "formless-button/FormlessButton";

FormlessButton will query <button> with data-method and data-url attributes.

<button data-method="DELETE" data-url="https://example.com/user/44">Delete user</button>

Under the hood, FormlessButton will listen for click event, after that FormlessButton will create & submit basic <form> with _token and _method inputs.

1.1.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago