Can we access an element of a content page from master page using JavaScript? Suppose I have a link like:<a id="myLink" class="styleLink runat="server"></a> in all my content pages that uses the master page. I want to add one plugin for all links which are having the css class “styleLink”. I can do it by adding ('.styleLink').ToolTip() this line in all my content pages. But I want to do it from master page so that plugin will be applied to all the links which are having css class “styleLink” and I need not require to go each content page and add this line of code.Can anyone help me how to do this if it is possible?
Can we access an element of a content page from master page using JavaScript?
Share
in your master page, put your scripts at the bottom, just before the
</body>tag and it should work.at the end of the day, you’re master and client pages combine to render one single HTML page.
scripts at the bottom will fire when the page is loaded. If you use a
domreadyevent that jQuery has then you could put the scripts anywhere and they should still work.