Skip to content

Commit 65bfaeb

Browse files
committed
move to a css solution instead of js
1 parent 704915b commit 65bfaeb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/resources/views/crud/inc/show_tabbed_fields.blade.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ class="nav-link {{ isset($tabWithError) ? ($tab == $tabWithError ? 'active' : ''
6363
.tab-pane .form-group h3:first-child {
6464
margin-top: 0;
6565
}
66-
</style>
67-
@endpush
6866
69-
@push('crud_fields_scripts')
70-
<script>
71-
// when select2 is multiple and it's not on the first displayed tab the placeholder would
72-
// not display correctly because the element was not "visible" on the page (hidden by tab)
73-
// thus getting `0px` width. This makes sure that the placeholder element is always 100% width
74-
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
75-
$('.select2-search .select2-search--inline').css('width', '100%');
76-
$('.select2-search__field').css('width', '100%');
77-
})
78-
</script>
67+
/*
68+
when select2 is multiple and it's not on the first displayed tab the placeholder would
69+
not display correctly because the element was not "visible" on the page (hidden by tab)
70+
thus getting `0px` width. This makes sure that the placeholder element is always 100% width
71+
by preventing the select2 inline style (0px) from applying using !important
72+
*/
73+
.select2-container,
74+
.select2-container li:only-child,
75+
.select2-container input:placeholder-shown {
76+
width: 100% !important;
77+
}
78+
</style>
7979
@endpush
8080

0 commit comments

Comments
 (0)