Thursday, March 2, 2017

Disable a link by adding a class and setting href with laravel blade

I want to disable a link by adding a class and setting its href.

I came up with this but I am not happy with it.

    <a class="linkclass {!! $disabled ? 'disabled' : '" href="/page' !!}">Link</a>

So my questions are:

  1. Is this a good practice? Do you recommend setting href by its condition of being disabled?
  2. Which is the way you would suggest to do that?



via llobet

Advertisement