Skip to content

Instantly share code, notes, and snippets.

@msulaimanmisri
Last active October 22, 2022 18:06
Show Gist options
  • Save msulaimanmisri/14b160bbb68b8f59abda78938c96041f to your computer and use it in GitHub Desktop.
Save msulaimanmisri/14b160bbb68b8f59abda78938c96041f to your computer and use it in GitHub Desktop.
When Laravel validation appear, Laravel Old Helper will not selected by default. We can use JavaScript to make it happen.
/**
* @author Muhamad Sulaiman Misri
*/
const oldValueOfYourSelector = '{{ old('selector') }}';
if (oldValueOfYourSelector !== '') {
$('selector').val(oldValueOfYourSelector);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment