<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>load js &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/load-js/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Fri, 17 Jul 2015 12:45:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>load js &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Dynamically load &#038; check whether it is loaded or not</title>
		<link>https://mail.sibeeshpassion.com/dynamically-load-check-whether-it-is-loaded-or-not/</link>
					<comments>https://mail.sibeeshpassion.com/dynamically-load-check-whether-it-is-loaded-or-not/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 29 Jan 2015 20:07:06 +0000</pubDate>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Check JS loaded or not]]></category>
		<category><![CDATA[externally call js files]]></category>
		<category><![CDATA[load jquery reference]]></category>
		<category><![CDATA[load js]]></category>
		<category><![CDATA[Load JS files dynamically]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1361</guid>

					<description><![CDATA[Introduction Since we are all working with client-side programming technologies, we may need to load JavaScript files dynamically sometimes. So we will learn how to do that in this article. Using the code First of all we will just create two buttons for testing as follows. [html] &#60;input type=“button” id=“loadjs” value=“Load Js” onclick=“load()” /&#62; &#60;input type=“button” id=“chk” value=“Check Load Js” onclick=“checkLoad()” /&#62; [/html] Once that is added, now it is the time to load the script. Please note that you must include that script file to your solution. Here I am adding the jquery-1.7.2.min.js. Now call the load function. Load [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Since we are all working with client-side programming technologies, we may need to load JavaScript files dynamically sometimes. So we will learn how to do that in this article.</p>
<p><strong>Using the code</strong></p>
<p>First of all we will just create two buttons for testing as follows.</p>
<p>[html]<br />
&lt;input type=“button” id=“loadjs” value=“Load Js” onclick=“load()” /&gt;<br />
&lt;input type=“button” id=“chk” value=“Check Load Js” onclick=“checkLoad()” /&gt;<br />
[/html]</p>
<p>Once that is added, now it is the time to load the script.</p>
<p>Please note that you must include that script file to your solution. Here I am adding the <em>jquery-1.7.2.min.js</em>.</p>
<p>Now call the load function.</p>
<p><strong>Load function</strong></p>
<p>[js]<br />
function load() {<br />
      var dynaScript = document.createElement(“script”);<br />
      dynaScript.id = “dynaJS”;<br />
      dynaScript.language = “javascript”;<br />
      dynaScript.type = “text/javascript”;<br />
      dynaScript.src = “jquery-1.7.2.min.js”;<br />
      document.getElementById(“myHead”).appendChild(dynaScript);<br />
}<br />
[/js]</p>
<p>Now we can check whether it is loaded or not.</p>
<p><strong>checkLoad() function</strong></p>
<p>[js]<br />
function checkLoad() {<br />
    if (!window.jQuery)<br />
        alert(“Not loaded”);<br />
    else<br />
        alert(“Loaded”);<br />
}<br />
[/js]</p>
<p><strong>Complete Code</strong><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=“http://www.w3.org/1999/xhtml”&gt;<br />
&lt;head id=“myHead”&gt;<br />
    &lt;title&gt;Load JS Files with script tag&lt;/title&gt;<br />
    &lt;script&gt;<br />
        function load() {<br />
// script creation start<br />
            var dynaScript = document.createElement(“script”);<br />
            dynaScript.id = “dynaJS”;<br />
            dynaScript.language = “javascript”;<br />
            dynaScript.type = “text/javascript”;<br />
            dynaScript.src = “jquery-1.7.2.min.js”;<br />
// script creation end<br />
            document.getElementById(“myHead”).appendChild(dynaScript);<br />
//Finally add it to our head element here.<br />
        }<br />
        function checkLoad() {<br />
            if (!window.jQuery)<br />
                alert(“Not loaded”);<br />
            else<br />
                alert(“Loaded”);<br />
        }<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    Sibeesh Passion (www.sibeeshpassion.com)<br />
    &lt;input type=“button” id=“loadjs” value=“Load Js” onclick=“load()” /&gt;<br />
    &lt;input type=“button” id=“chk” value=“Check Load Js” onclick=“checkLoad()” /&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Output</strong></p>
<p>Now we will run the application and see the output. I have included the output as in the images below.</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/dynamically-load-js-files-and-check-whether-it-is-loaded-or/Images/Browser%20console%20before%20loads%20JS.jpg" alt="Browser console before loads JS" /><br />
<strong> Figure: </strong>Browser console before loads JavaScript</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/dynamically-load-js-files-and-check-whether-it-is-loaded-or/Images/After%20loads%20JS.jpg" alt="After loads JS" /><br />
<strong>Figure:</strong> After loads JavaScript</p>
<p>When you click the Check Load button, you will get an alert saying that jQuery has been loaded.</p>
<p><strong>Conclusion</strong></p>
<p>Please provide your valuable suggestions and comments. Thanks in advance.</p>
<p>Kindest Regards,<br />
<a href="http://www.sibeeshpassion.com/" rel="nofollow">Sibeesh Venu</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/dynamically-load-check-whether-it-is-loaded-or-not/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
