How to detect the value of selected page template in the edit page? I have used jQuery to select the page attribute select box but it is not working when we hide the editor sidebar; Because it removes the markup of that settings. I think it keeps data somewhere as we are able to bring back the sidebar without any change.
My code:
$('.editor-page-attributes__template select').val()
Is there any way to get the value when the sidebar is closed? Like any JavaScript variable in the page that updates when we change page template.
Note: I mean getting the value and use it in JavaScript without refreshing or updating the editor.