SNT93
SNT93

Reputation: 476

How can I Hide a TextField of Laravel Form?

I want a text field to be hidden for default for a TextField in Laravel Form and then Unhide it when I click a checkbox..

How can I do that ?

Tried adding style properties to the TextField :

{{Form::text('Password', $user->email, array('class' => 'form-control' , 'style' => 'visible = false;'))}}

didn't work..

Upvotes: 0

Views: 2767

Answers (1)

xhulio
xhulio

Reputation: 1103

{{Form::text('Password', $user->email, array('class' => 'form-control hidden'))}}

and on javascript:

$(document).ready(function (){
    $('#checkbox').change(function (){
        $('.form-control.hidden').removeclass('hidden');
    });
});

Upvotes: 3

Related Questions