Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #295
    jacob_smith
    Participant

    I have an error on my Alpine Js component

    Alpine JS component:

    <form x-data=”” wire:submit.prevent=”reply”>
    <textarea x-on:keydown.enter=”submit”>
    <button type=”submit”>
    </form>

    <script>
    function sendButton() {
    return {
    submit() {
    console.log(‘data submitted’);
    }
    }
    }
    </script>

    The errror:

    Alpine Expression Error: submit is not defined

    Uncaught ReferenceError: submit is not defined at eval

    • This topic was modified 1 year, 3 months ago by jacob_smith.
    #296

    You didn’t define the function on your x-data declaration:

    <form x-data=”sendButton” wire:submit.prevent=”reply”>

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.