Is it possible to yield variable in jquery? I want to set a variable in partial views, based on the variable I set a certain menu item as active. I have a menu where I want to yield the active item like this (in my main layout view):
function setMenu(){
$('#menu-item-'@yield('menu-item', 'home')).addClass('active');
}
unfortunately this isn't valid. Is it possible to yield with blade in jquery?
my current 'fix'
View
@if ($menuItem = 'news') @endif
Layout
setMenu('@if(isset($menuItem)){{ $menuItem }}@endif ');