
The most obvious example is the Click event of buttons, links, and clickable images. Often, you'll need to react to an event initiated by an XMod Pro control. Using Javascript Inside XMod Pro Tag Attributes It's a contrived example but keeps the code simple. When it is clicked, you want an alert to popup. So how would this all look? Let's say you had a hyperlink on your page with a class name of "my-button". Finally, by inserting your code near the bottom of the page, it helps the user see your page faster, aiding in performance. It ensures that other variables on the page do not interfere with your code so you don't have any conflicts with other libraries and plugins that may be registered on the page. This allows you to safely use the " $" operator in your Javascript to refer to jQuery. It wraps the block in a closure and inserts the block near the end of the page. XMod Pro makes this simple with the tag for Forms and the tag for Templates.įor those who know jQuery, these tags put a jQuery document ready block in the page. This is often required by jQuery libraries or any Javascript that manipulates elements on your page. If your site is using jQuery (and just about every recent DNN version automatically includes it), you can easily add your Javascript to the page and have it execute after the browser has loaded the DOM (Document Object Model). Running Javascript After Page Load With jQuery Use the tag in Templates and the tag in Forms. If you need to register a Javascript libraries in other files or inject a function or several functions, use a Script Block tag. Injecting Javascript Into the Pageįor plain Javascript, you can simply type it into your Form or Template and it will be rendered out to the page at run-time. Instead it provides techniques for incorporating your scripts, whether they are plain Javascript or jQuery, into your XMod Pro solutions. This topic won't teach you how to use Javascript.
