Laravel onclick function not working

Created at 24-Sep-2021 , By samar

Laravel onclick function not working

In this session, we will try our hand at solving the "Laravel onclick function not working".

There could be any reason that laravel onclick function not working in your case. Here we provide code snippet on onclick event which helps you to find out the solution for your problem
  • Get data-id attribute value using onclick event on button in javascript

    <button data-id="5" onclick="followUser(this); return false;">Follow</button>
    function followUser(e){
        var id = e.getAttribute('data-id');

    This code snippet will help you to get the value of data-id attribute using onclick event on button in javascript.

  • JQuery get data id attribute value on click button

    <script src=""></script>
    <button type="button" data-id="5" id="Button">Follow</button>
        $('#Button').on('click', function(){
        	var value = $(this).attr('data-id');

Back to code snippet queries related laravel

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.