I am trying to disabled an input field if it has value. Somehow, it looks like this:
<input type="text" name="sex" value="{{ old('sex', $user['sex']) }}" placeholder="">
I have tried adding like:
<input type="text" name="sex" value="{{ old('sex', $user['sex']) }}"
disabled= {{ $user['sex'] == null ? disabled :'' }} >
But it is not working. I am using blade.php by the way.
Try this
<input type="text" name="sex" value="{{ old('sex', $user['sex']) }}" {{ $user['sex'] ? '' : 'disabled' }} >