formless-button
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i formless-button

Weekly Downloads

1

Version

1.1.0

License

ISC

Unpacked Size

9.91 kB

Total Files

18

Last publish

Collaborators

  • matusboa