Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

laravel livewire


I have a problem in Livewire 2 when the modal close the page is disabled,


document.addEventListener('livewire:load', function () {
Livewire.on('success', function () {
$('#kt_modal_add_user').modal('hide');
window.LaravelDataTables['users-table'].ajax.reload();
});
});

public function submit()
{
$this->emit('success', __('New user created'));
$this->reset();
}

<div class="modal fade" id="kt_modal_add_user" tabindex="-1" aria-hidden="true" wire:ignore.self>

Any help?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Moaz,

May I know if you already have customise the existing Laravel? This behavior might be due to the modal not being properly hidden or other JavaScript conflicts. Here are some steps to troubleshoot the issue:

Double-check that the modal is being properly hidden when you call $('#kt_modal_add_user').modal('hide');. Ensure that the modal ID matches the actual ID of your modal element.

Look in your browser's developer console for any JavaScript errors that might be causing issues. These errors can sometimes interfere with Livewire components.

Add console.log statements in your JavaScript code to debug the issue. For example, you can add console.log('Modal closed'); after $('#kt_modal_add_user').modal('hide'); to see if it's being executed as expected.

Thanks


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(