I have this template that includes videos from youtube being loaded with swfobject.
Is there a way to include a script tag...
<script type="text/javascript"> </script>
inside a jQuery Template??
<script id="filaVideoTemplate" type="text/x-jQuery-tmpl"> <!-- Some HTML here --> <script type="text/javascript"> <!-- Some javascript here --> </script> </script>
Obviously it doesn't work directly, is there any way to achive the same thing without the script inside other script?
In the web page write your jQuery code within document ready state in the <script > tag. In the example, I used CDN library and defined click event on the button. On the click change value of the textbox element.
The <script> tag can be placed in the <head> section of your HTML or in the <body> section, depending on when you want the JavaScript to load. Generally, JavaScript code can go inside of the document <head> section in order to keep them contained and out of the main content of your HTML document.
The <template> tag is used as a container to hold some HTML content hidden from the user when the page loads. The content inside <template> can be rendered later with a JavaScript. You can use the <template> tag if you have some HTML code you want to use over and over again, but not until you ask for it.
The <template> HTML element is a mechanism for holding HTML that is not to be rendered immediately when a page is loaded but may be instantiated subsequently during runtime using JavaScript. Think of a template as a content fragment that is being stored for subsequent use in the document.
<script id="filaVideoTemplate" type="text/x-jQuery-tmpl"> <!-- Some HTML here --> <script type="text/javascript"> <!-- Some javascript here --> {{html "</sc"+"ript>"}} </script>
You can use {{html "</sc"+"ript>"}} replace </script>
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