A.Wen
A.Wen

Reputation: 223

How to call an on click action for button in Laravel 5?

Below is my submit button code.

{!! Form::submit('Update', array('class'=>'btn btn-primary','style'=>'width: 200px')) !!}

I want to change that by adding onclick event as below.

onclick="if( ! confirm('Are you sure you want to delete?')){return false;}">

How to code that in laravel?

Upvotes: 0

Views: 2328

Answers (1)

Filip Koblański
Filip Koblański

Reputation: 10018

If you're not using the jQuery then you can add it to array like:

{!! Form::submit('Update', array(
    'class'   => 'btn btn-primary',
    'style'   => 'width: 200px',
    'onclick' => "if( ! confirm('Are you sure you want to delete?')){return false;}"
)) !!}

Upvotes: 1

Related Questions