I need to include a javascript file to webpage. I write the following:
include /../scripts/jquery.timeago.js
but I get
<script>/* * timeago: a jQuery plugin, version: 0.8.2 (2010-02-16) * @requires jQuery v1.2.3 or later * * Timeago is a jQuery plugin that makes it easy to support automatically * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). * * For usage and examples, visit: * http://timeago.yarp.com/ * * Licensed under the MIT: * http://www.opensource.org/licenses/mit-license.php * * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) */ (function($) { .... </script>
as result. But I need:
<script src="/Scripts/jquery.timeago.js" type="text/javascript"></script>
How to do it?
To include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the <head> tags in your HTML document.
JavaScript in <head> or <body> You can place any number of scripts in an HTML document. Scripts can be placed in the <body> , or in the <head> section of an HTML page, or in both.
Put this in your jade file:
script(src="/Scripts/jquery.timeago.js")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With