Having trouble capturing the current DNN page name and assigning it to a variable in javascript. Despite searching online, I haven't been able to find the right code for it.
<script type="text/javascript"> var tabName = <% =TabName %>; </script>
Currently resorting to using document.title as a workaround, but I really prefer using PageName.
Here's my functioning javascript:
/* add active class to Mega-Menu item if Page Title matches data-linkname */ var tabName = document.title; $('.megamenu .second-level-list li[data-pagename="' + tabName + '"]').addClass('active');
And here's what I'd like to use:
/* add active class to Mega-Menu item if Page Name matches data-linkname */ var tabName = '<% =TabName %>'; $('.megamenu .second-level-list li[data-pagename="' + tabName + '"]').addClass('active');
I also attempted this without success:
var tabName = '<% =TabController.CurrentPage.TabName %>';
What is the correct method to assign the current page name to a javascript variable?
Running on DNN PLATFORM v.09.01.01 with 4.6.NET FRAMEWORK
Thank you, Craig