Laravel Blade Inline Style not working

4.7k views Asked by At

This is the line:

 {!! Form::checkbox('notify_email', null, ['class' => 'icheckbox', 'style'=>'position:absolute; opacity:0',  'checked' => 'checked', 'type' => 'checkbox' ]) !!}

Why is the 'style' not appearing on the HTML?

This is what appears:

<input checked="checked" name="notify_email" type="checkbox">
2

There are 2 answers

0
Jake Opena On

Illuminate\Html\FormBuilder:

/**
 * Create a checkbox input field.
 *
 * @param  string  $name
 * @param  mixed   $value
 * @param  bool    $checked
 * @param  array   $options
 * @return string
 */
public function checkbox($name, $value = 1, $checked = null, $options = array())
{
    return $this->checkable('checkbox', $name, $value, $checked, $options);
}
0
TheDream On

Solved:

You need 4 parameters for a checkbox not 3 like a regular input.

{!! Form::checkbox('notify_email', 'checked', true, ['class' => 'icheckbox', 'checked' => 'checked',  'style'=>'position:absolute; opacity:0' ]) !!}