Difference between revisions of "JQuery"

From SmartWiki
Jump to: navigation, search
(Created page with 'If you wish to use jQuery you should include the following script tags within a Browser Script custom field, or on the Template Page if appropriate. <script type="text…')
 
Line 1: Line 1:
If you wish to use jQuery you should include the following script tags within a [[Browser Script]] custom field, or on the [[Template Page]] if appropriate.
+
If you wish to use jQuery you should include the following script tags within a [[Browser Script]] custom field, or on the Template Page if appropriate.
  
  

Revision as of 09:48, 31 October 2012

If you wish to use jQuery you should include the following script tags within a Browser Script custom field, or on the Template Page if appropriate.


<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript" src="/jquery/jquery-ui.min.js"></script>


If the jQuery is to be used on a Web Page View custom field you must use the following method rather than using script tags:

<head>
<script language="JavaScript">

function include_dom(script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}
function includejsfiles() {
  include_dom("/jquery/jquery.js");
  include_dom("/jquery/jquery-ui.min.js");
}

</script>
</head>
 <BODY onload="includejsfiles()">

...