
<?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>Javascript JQuery Examples &#8211; CodeInDotNet</title>
	<atom:link href="https://www.codeindotnet.com/category/javascript-jquery-examples/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codeindotnet.com</link>
	<description>C# Dot Net Programming tutorial &#38; code examples</description>
	<lastBuildDate>Tue, 02 Apr 2024 06:25:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>

<image>
	<url>https://www.codeindotnet.com/wp-content/uploads/2021/04/SiteIcon.png</url>
	<title>Javascript JQuery Examples &#8211; CodeInDotNet</title>
	<link>https://www.codeindotnet.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Redirect a Page After 5 Seconds Using JavaScript and jQuery</title>
		<link>https://www.codeindotnet.com/redirect-page-after-5-seconds-countdown-delay/</link>
					<comments>https://www.codeindotnet.com/redirect-page-after-5-seconds-countdown-delay/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 09 Mar 2024 14:41:01 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=7202</guid>

					<description><![CDATA[Redirecting users to another page after a few seconds can be useful in web development when a certain action is performed and automatically you want to redirect the page to another internal or external link. This article explains how to implement a simple redirection after 5 seconds using both JavaScript and jQuery, with a complete [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInHoriAd1"></div>
<script>
fetch('/gads/PageInHoriAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInHoriAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInHoriAd1:', error);
	});
</script>



<p>Redirecting users to another page after a few seconds can be useful in web development when a certain action is performed and automatically you want to redirect the page to another internal or external link. This article explains how to implement a simple redirection after 5 seconds using both JavaScript and jQuery, with a complete HTML example.</p>



<br>



<h2 class="wp-block-heading h2Cust1" id="automatically-redirect-to-another-page"><strong>Automatically Redirect to Another Page</strong></h2>



<br>



<div>Steps:</div>



<ol class="ol1 wp-block-list">
<li>To redirect use <span class="spanHT">window.location.href</span></li>



<li>To delay redirection use <span class="spanHT">setTimeout</span> or <span class="spanHT">setInterval</span></li>
</ol>



<br><br>



<h2 class="wp-block-heading hLBRed" id="1-window-location-href"><strong>1. window.location.href</strong></h2>



<br>



<p>Use <span class="spanHT">window.location.href</span> to redirect page to another URL.</p>



<p><strong><em>example:</em></strong></p>



<pre class="pchl"><code><span class="key">function</span> redirect() {
        window.location.href = <span class="str">"https://codeindotnet.com"</span>; 
    } </code></pre>



<br><br><br>



<h2 class="wp-block-heading hLBRed" id="2-use-set-timeout-or-set-interval"><strong>2. Use setTimeout or setInterval</strong></h2>



<br>



<p>To delay the redirection to another page after some action, you can use one of the following methods:</p>



<ol type="a" class="ol1 wp-block-list">
<li>setTimeout()  <strong>or</strong></li>



<li>setInterval()</li>
</ol>



<br><br>



<h3 class="wp-block-heading" id="a-redirect-using-set-timeout"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">a.</mark> Redirect Using setTimeout()</strong></h3>



<br>



<p>The HTML example below explains how to delay page redirection using <span class="spanHT">setTimeout()</span>. </p>



<pre class="pchl"><code>setTimeout(redirect, 5000); <span class="com">// rediret after 5 seconds</span></code></pre>



<br><br>



<h4 class="wp-block-heading" id="create-the-html-structure"><strong>Create the HTML Structure:</strong></h4>



<button class="c-b-s-f-r" onclick="ctc('div1',this)">Copy code</button>
<br>
<div id="div1">
<pre class="pchl"><code>&lt;!DOCTYPE html&gt
&lt;html lang=<span class="str">"en"</span>&gt
&lt;head&gt
    &lt;meta charset=<span class="str">"UTF-8"</span>&gt
    &lt;meta name=<span class="str">"viewport"</span> content=<span class="str">"width=device-width, initial-scale=1.0"</span>&gt
    &lt;title&gtPage Redirection&lt;/title&gt
&lt;/head&gt
&lt;body&gt
    &lt;div&gt
        &lt;p&gtYou will be redirected in 5 seconds...&lt;/p&gt
    &lt;/div&gt

    <span class="com">&lt;!-- Add your JavaScript or jQuery code here --&gt</span>
&lt;/body&gt
&lt;/html&gt </code></pre>
</div>



<br><br>



<h4 class="wp-block-heading" id="implement-script-javascript-or-j-query"><strong>Implement Script (Javascript or jQuery)</strong></h4>



<br>



<div><b>Javascript Code:</b></div>



<button class="c-b-s-f-r" onclick="ctc('div2',this)">Copy code</button>
<br>
<div id="div2">
<pre class="pchl"><code>&lt;script&gt
    <span class="com">// Function to redirect after 5 seconds</span>
    <span class="key">function</span> redirect() {
        window.location.href = <span class="str">"https://codeindotnet.com"</span>;
    }

    <span class="com">// Call the redirect function after 5 seconds</span>
    <span style="background:#f2f19d;">setTimeout(redirect, 5000);</span> <span class="com">// 5000 milliseconds = 5 seconds</span>
&lt;/script&gt </code></pre>
</div>



<br><br>



<div><b>jQuery Code:</b></div>



<button class="c-b-s-f-r" onclick="ctc('div3',this)">Copy code</button>
<br>
<div id="div3">
<pre class="pchl"><code>&lt;script src=<span class="str">"https://code.jquery.com/jquery-3.6.0.min.js"</span>&gt&lt;/script&gt
&lt;script&gt
    $(document).ready(<span class="key">function</span>() {
        <span class="com">// Function to redirect after 5 seconds</span>
        <span class="key">function</span> redirect() {
            window.location.href = <span class="str">"https://codeindotnet.com"</span>; 
        }

        <span class="com">// Call the redirect function after 5 seconds</span>
        <span style="background:#f2f19d;">setTimeout(redirect, 5000);</span> <span class="com">// 5000 milliseconds = 5 seconds</span>
    });
&lt;/script&gt </code></pre>
</div>



<br><br><br>



<h3 class="wp-block-heading" id="b-redirect-using-set-interval"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">b.</mark> Redirect Using setInterval()</strong></h3>



<br>



<p>Alternatively, you can also use the <span class="spanHT">setInterval()</span> method to set a timer, like for 5 seconds, and then after that time, send the user to a different web address.</p>



<pre class="pchl"><code>setInterval(</span><span class="key">function</span>() {
	</span><span class="com">... redirection code...</span>
}, 1000);</code></pre>



<br><br>



<h4 class="wp-block-heading" id="full-html-code-implementation"><strong>Full HTML code &amp; implementation:</strong></h4>



<button class="c-b-s-f-r" onclick="ctc('div4',this)">Copy code</button>
<br>
<div id="div4">
<pre class="pchl"><code>&lt;!DOCTYPE html&gt
&lt;html lang=<span class="str">"en"</span>&gt
&lt;head&gt
&lt;meta charset=<span class="str">"UTF-8"</span>&gt
&lt;meta name=<span class="str">"viewport"</span> content=<span class="str">"width=device-width, initial-scale=1.0"</span>&gt
&lt;title&gtDelay in Page Redirection&lt;/title&gt

<div style="background-color: #d3d3d338; line-height: 1.6;">&lt;script&gt
var count = 0;  <span class="com">// Declare counter</span>
var sint = <span style="background:#f2f19d;">setInterval(</span><span class="key">function</span>() {
	count++;  <span class="com">// Increment counter</span>
	if(count == 5) {  <span class="com">// If count is 5secs, redirect user</span>
		document.getElementById(<span class="str">"countdown"</span>).innerHTML = count;
		clearInterval(sint);
		window.location.href = <span class="str">"https://codeindotnet.com"</span>; <span class="com">// Redirect URL</span>
	}
	else {
		<span class="com">// Display updated counter</span>
		document.getElementById(<span class="str">"countdown"</span>).innerHTML = count;
	}
<span style="background:#f2f19d;">}, 1000)</span>;
&lt;/script&gt</div>

&lt;/head&gt
&lt;body&gt
    &lt;div&gt
		&lt;br&gt
        &lt;p&gtYou will be redirected in &lt;span id=<span class="str">"countdown"</span>&gt0&lt;/span&gt seconds...&lt;/p&gt        
    &lt;/div&gt
&lt;/body&gt
&lt;/html&gt </code></pre>
</div>



<div id="PageInAd1"></div>
<script>
fetch('/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<br>



<br>
<script src="/my-js/latesttop10post.js" type="text/javascript"></script>
<input type="hidden" id="cids" value="129,138,103,140,139,141">
<div id="latestPostlist"></div>
<br>



<div class="wp-block-rank-math-toc-block toc-cust" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#1-window-location-href">1. window.location.href</a></li><li><a href="#2-use-set-timeout-or-set-interval">2. Use setTimeout or setInterval</a><ul><li><a href="#a-redirect-using-set-timeout">a. Redirect Using setTimeout()</a><ul><li><a href="#create-the-html-structure">Create the HTML Structure:</a></li><li><a href="#implement-script-javascript-or-j-query">Implement Script (Javascript or jQuery)</a></li></ul></li><li><a href="#b-redirect-using-set-interval">b. Redirect Using setInterval()</a><ul><li><a href="#full-html-code-implementation">Full HTML code &amp; implementation:</a></li></ul></li></ul></li></ul></nav></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codeindotnet.com/redirect-page-after-5-seconds-countdown-delay/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Different Ways to Get Window/Screen Size &#8211; Javascript, jQuery</title>
		<link>https://www.codeindotnet.com/detect-screen-size-javascript-jquery/</link>
					<comments>https://www.codeindotnet.com/detect-screen-size-javascript-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 08 Mar 2024 04:18:32 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=7143</guid>

					<description><![CDATA[This article will show how to check browser size using JavaScript and jQuery. It is helpful to understand the screen size of your users&#8217; devices to deliver a better responsive page &#38; user experience. Detecting Screen Size with JavaScript 1. Using innerWidth and innerHeight properties JavaScript provides a straightforward way to detect screen size using [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInHoriAd1"></div>
<script>
fetch('/gads/PageInHoriAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInHoriAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInHoriAd1:', error);
	});
</script>



<br>



<p>This article will show how to check browser size using JavaScript and jQuery. It is helpful to understand the screen size of your users&#8217; devices to deliver a better responsive page &amp; user experience.</p>



<br>



<div class="wp-block-rank-math-toc-block toc-cust" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#detecting-screen-size-with-java-script">Detecting Screen Size with JavaScript</a><ul><li><a href="#1-using-inner-width-and-inner-height-properties">1. Using innerWidth and innerHeight properties</a></li><li><a href="#2-using-document-document-element-client-width-and-document-document-element-client-height">2. Using document.documentElement.clientWidth and document.documentElement.clientHeight</a></li><li><a href="#3-using-screen-width-and-screen-height">3. Using screen.width and screen.height</a></li></ul></li><li><a href="#detecting-screen-size-with-j-query">Detecting Screen Size with jQuery</a><ul><li><a href="#1-using-window-width-and-window-height">1. Using $(window).width() and $(window).height()</a></li><li><a href="#2-using-document-width-and-document-height">2. Using $(document).width() and $(document).height()</a></li><li><a href="#3-using-window-outer-width-and-window-outer-height">3. Using $(window).outerWidth() and $(window).outerHeight()</a></li></ul></li></ul></nav></div>



<br><br><br>



<h2 class="wp-block-heading h2Cust1" id="detecting-screen-size-with-java-script"><strong>Detecting Screen Size with JavaScript</strong></h2>



<br>



<h3 class="wp-block-heading" id="1-using-inner-width-and-inner-height-properties"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">1.</mark> Using innerWidth and innerHeight properties</strong></h3>



<p class="custp1">JavaScript provides a straightforward way to detect screen size using the <span class="spanHT">window</span> object. You can access the <span class="spanHT">innerWidth</span> and <span class="spanHT">innerHeight</span> properties of the <span class="spanHT">window</span> object to get the width and height of the viewport.</p>



<br><div><b><i>code snippet:</i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div1',this)">Copy code</button>
<br>
<div id="div1">
<pre class="pchl"><code><span class="com">// JavaScript</span>
<span class="key">const</span> screenWidth = window.innerWidth;
<span class="key">const</span> screenHeight = window.innerHeight;

console.log(<span class="str">"Screen width: "</span> + screenWidth);
console.log(<span class="str">"Screen height: "</span> + screenHeight); </code></pre>
</div>



<br><br>
<div><b><i>full html &#038; javascript code:</i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div2',this)">Copy code</button>
<br>
<div id="div2">
<pre class="pchl"><code>&lt;!DOCTYPE html&gt
&lt;html lang=<span class="str">"en"</span>&gt
&lt;head&gt
&lt;meta charset=<span class="str">"UTF-8"</span>&gt
&lt;meta name=<span class="str">"viewport"</span> content=<span class="str">"width=device-width, initial-scale=1.0"</span>&gt
&lt;title&gtWindow Resize Detection&lt;/title&gt
&lt;/head&gt
&lt;body&gt

&lt;div&gtScreen Size: &lt;span id=<span class="str">"width"</span>&gt&lt;/span&gt x &lt;span id=<span class="str">"height"</span>&gt&lt;/span&gt&lt;/div&gt

&lt;script&gt
  <span class="com">// Function to update screen size</span>
  <span class="key">function</span> updateSize() {
    <span class="key">var</span> width = window.innerWidth;
    <span class="key">var</span> height = window.innerHeight;
    document.getElementById(<span class="str">'width'</span>).textContent = width;
    document.getElementById(<span class="str">'height'</span>).textContent = height;
  }

  <span class="com">// Initial call to update size</span>
  updateSize();

  <span class="com">// Add event listener for window resize</span>
  window.addEventListener(<span class="str">'resize'</span>, <span class="key">function</span>() {
    updateSize();
  });
&lt;/script&gt

&lt;/body&gt
&lt;/html&gt </code></pre>
</div>



<br><br><div><b><i>output:</i></b></div>



<p class="custp1">The below screenshot shows, resizing the window and capturing the current screen size for a responsive page.</p>



<figure class="wp-block-image size-large"><img decoding="async" src="/img/1/javascript-detect-screen-size-responsive.jpg" alt="javascript detect screen size responsive"/></figure>



<br><br>



<p><strong><span style="font-size: 1.44rem;">Alternative Methods:</span></strong></p>



<h3 class="wp-block-heading" id="2-using-document-document-element-client-width-and-document-document-element-client-height"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">2.</mark> Using document.documentElement.clientWidth and document.documentElement.clientHeight</strong></h3>



<p class="custp1">These properties return the width and height of the viewport, excluding the scrollbar, in pixels.</p>



<button class="c-b-s-f-r" onclick="ctc('div3',this)">Copy code</button>
<br>
<div id="div3">
<pre class="pchl"><code><span class="key">const</span> screenWidth = document.documentElement.clientWidth;
<span class="key">const</span> screenHeight = document.documentElement.clientHeight; </code></pre>
</div>



<br><br>



<h3 class="wp-block-heading" id="3-using-screen-width-and-screen-height"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">3.</mark> Using screen.width and screen.height</strong></h3>



<p class="custp1">These properties return the total width and height of the user&#8217;s screen, including the taskbar and any other system elements.</p>



<button class="c-b-s-f-r" onclick="ctc('div4',this)">Copy code</button>
<br>
<div id="div4">
<pre class="pchl"><code><span class="key">const</span> screenWidth = screen.width;
<span class="key">const</span> screenHeight = screen.height; </code></pre>
</div>



<br><br><br><br>



<h2 class="wp-block-heading h2Cust1" id="detecting-screen-size-with-j-query"><strong>Detecting Screen Size with jQuery</strong></h2>



<br>



<h3 class="wp-block-heading" id="1-using-window-width-and-window-height"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">1.</mark> Using $(window).width() and $(window).height()</strong></h3>



<p class="custp1">If you&#8217;re already using jQuery in your project then use the <span class="spanHT">$(window).width()</span> and <span class="spanHT">$(window).height()</span> functions to get the window&#8217;s width &amp; height of the viewport.</p>



<br><div><b><i>code snippet:</i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div5',this)">Copy code</button>
<br>
<div id="div5">
<pre class="pchl"><code><span class="com">// jQuery</span>
<span class="key">const</span> screenWidth = $(window).width();
<span class="key">const</span> screenHeight = $(window).height();

console.log(<span class="str">"Screen width: "</span> + screenWidth);
console.log(<span class="str">"Screen height: "</span> + screenHeight); </code></pre>
</div>



<br><br>
<div><b><i>full html &#038; jquery code:</i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div6',this)">Copy code</button>
<br>
<div id="div6">
<pre class="pchl"><code>&lt;!DOCTYPE html&gt
&lt;html lang=<span class="str">"en"</span>&gt
&lt;head&gt
&lt;meta charset=<span class="str">"UTF-8"</span>&gt
&lt;meta name=<span class="str">"viewport"</span> content=<span class="str">"width=device-width, initial-scale=1.0"</span>&gt
&lt;title&gtWindow Resize Detection with jQuery&lt;/title&gt
&lt;script src=<span class="str">"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"</span>&gt&lt;/script&gt
&lt;/head&gt
&lt;body&gt

&lt;div&gtScreen Size: &lt;span id=<span class="str">"width"</span>&gt&lt;/span&gt x &lt;span id=<span class="str">"height"</span>&gt&lt;/span&gt&lt;/div&gt

&lt;script&gt
  <span class="com">// Function to update screen size</span>
  <span class="key">function</span> updateSize() {
    <span class="key">var</span> width = $(window).width();
    <span class="key">var</span> height = $(window).height();
    $('#width').text(width);
    $('#height').text(height);
  }

  <span class="com">// Initial call to update size</span>
  updateSize();

  <span class="com">// Add event listener for window resize using jQuery</span>
  $(window).resize(<span class="key">function</span>() {
    updateSize();
  });
&lt;/script&gt

&lt;/body&gt
&lt;/html&gt </code></pre>
</div>



<br><br>



<p><strong><span style="font-size: 1.44rem;">Alternative Methods:</span></strong></p>



<h3 class="wp-block-heading" id="2-using-document-width-and-document-height"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">2.</mark> Using $(document).width() and $(document).height()</strong></h3>



<p class="custp1">These functions return the width and height of the entire document, including any overflowed content.</p>



<button class="c-b-s-f-r" onclick="ctc('div7',this)">Copy code</button>
<br>
<div id="div7">
<pre class="pchl"><code><span class="key">const</span> docWidth = $(document).width();
<span class="key">const</span> docHeight = $(document).height(); </code></pre>
</div>



<br><br>



<h3 class="wp-block-heading" id="3-using-window-outer-width-and-window-outer-height"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">3.</mark> Using $(window).outerWidth() and $(window).outerHeight()</strong></h3>



<p class="custp1">These functions return the width and height of the viewport, including any scrollbar and borders.</p>



<button class="c-b-s-f-r" onclick="ctc('div8',this)">Copy code</button>
<br>
<div id="div8">
<pre class="pchl"><code><span class="key">const</span> outerWidth = $(window).outerWidth();
<span class="key">const</span> outerHeight = $(window).outerHeight(); </code></pre>
</div>



<div id="PageInAd1"></div>
<script>
fetch('/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<br><br>
<script src="/my-js/latesttop10post.js" type="text/javascript"></script>
<input type="hidden" id="cids" value="129,138,103,140,139,141">
<div id="latestPostlist"></div>
<br>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codeindotnet.com/detect-screen-size-javascript-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Different ways to get child Elements from Javascript and jQuery</title>
		<link>https://www.codeindotnet.com/get-child-element-javascript-jquery/</link>
					<comments>https://www.codeindotnet.com/get-child-element-javascript-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 26 Feb 2024 08:32:47 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=6870</guid>

					<description><![CDATA[Get Child Element from Parent It is a common task in web development to retrieve child elements by their IDs. JavaScript and jQuery offer several approaches that can help developers choose the most suitable one for their projects. In this article, we&#8217;ll explore various techniques to retrieve child elements using JavaScript and jQuery with examples. [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInHoriAd1"></div>
<script>
fetch('/gads/PageInHoriAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInHoriAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInHoriAd1:', error);
	});
</script>



<br>



<h2 class="wp-block-heading h2Cust1" id="get-child-element-from-parent"><strong>Get Child Element from Parent</strong></h2>



<p>It is a common task in web development to retrieve child elements by their IDs. JavaScript and jQuery offer several approaches that can help developers choose the most suitable one for their projects. In this article, we&#8217;ll explore various techniques to retrieve child elements using JavaScript and jQuery with examples.</p>



<br>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="545" height="264" src="https://www.codeindotnet.com/wp-content/uploads/2024/02/get-child-element-from-parent.jpg" alt="Get Child Element from Parent" class="wp-image-6936" srcset="https://www.codeindotnet.com/wp-content/uploads/2024/02/get-child-element-from-parent.jpg 545w, https://www.codeindotnet.com/wp-content/uploads/2024/02/get-child-element-from-parent-300x145.jpg 300w" sizes="(max-width: 545px) 100vw, 545px" /></figure></div>


<br><br><br>



<h2 class="wp-block-heading h2Cust1" id="get-child-element-using-javascript"><strong>Get Child Element Using Javascript</strong></h2>



<br><br>



<h3 class="wp-block-heading hLBRed" id="1-get-child-element-by-id"><strong>1. get child element by id</strong></h3>



<br>



<h4 class="wp-block-heading" id="a-get-element-by-id"><strong>a. getElementById():</strong></h4>



<p class="custp1">This native JavaScript method retrieves an element by its ID attribute.</p>



<button class="c-b-s-f-r" onclick="ctc('div1',this)">Copy code</button>
<br>
<div id="div1"><pre class="pchl"><code>&lt;div id=<span class="str">"parent"</span>&gt;
    &lt;div id=<span class="str">"child"</span>&gt;Child Element&lt;/div&gt;
&lt;/div&gt;

<span class="key">const</span> childElement = document.getElementById(<span class="str">'child'</span>);</code></pre>
</div>



<br><br>



<h4 class="wp-block-heading" id="b-query-selector"><strong>b. querySelector():</strong></h4>



<p class="custp1">The querySelector method allows for a more flexible selection using CSS selectors, including IDs.</p>



<button class="c-b-s-f-r" onclick="ctc('div2',this)">Copy code</button>
<br>
<div id="div2"><pre class="pchl"><code><span class="key">const</span> childElement = document.querySelector(<span class="str">'#child'</span>);
</code></pre>
</div>



<br><br><br>



<h3 class="wp-block-heading hLBRed" id="2-get-child-element-by-tag"><strong>2. get child element by tag</strong></h3>



<br>



<h4 class="wp-block-heading" id="a-get-element-by-id-with-get-elements-by-tag-name"><strong>a. getElementById() with getElementsByTagName():</strong></h4>



<p class="custp1">One straightforward way to retrieve child elements by tag is by combining getElementById() and getElementsByTagName(). This method is useful when you need to find elements within a specific parent element.</p>



<button class="c-b-s-f-r" onclick="ctc('div3',this)">Copy code</button>
<br>
<div id="div3"><pre class="pchl"><code><span class="key">const</span> parentElement = document.getElementById(<span class="str">"parent-id"</span>);
<span class="key">const</span> childElements = parentElement.getElementsByTagName(<span class="str">"tag-name"</span>);</code></pre>
</div>



<br><br>



<h4 class="wp-block-heading" id="b-query-selector-all"><strong>b. querySelectorAll():</strong></h4>



<p class="custp1">The querySelectorAll() method allows you to select elements using CSS selectors, including tag names. This method returns a static NodeList containing all matching elements within the specified parent element.</p>



<button class="c-b-s-f-r" onclick="ctc('div4',this)">Copy code</button>
<br>
<div id="div4"><pre class="pchl"><code><span class="key">const</span> childElements = document.querySelectorAll(<span class="str">"#parent-id tag-name"</span>);
or
<span class="key">const</span> childElements = document.querySelectorAll(<span class="str">".parent-id .tag-name"</span>);</code></pre>
</div>



<br><br>



<h4 class="wp-block-heading" id="c-children-property"><strong>c. Children Property:</strong></h4>



<p class="custp1">The children property of a DOM element returns a collection of the element&#8217;s child elements. You can then iterate through this collection and filter out elements based on their tag names.</p>



<button class="c-b-s-f-r" onclick="ctc('div5',this)">Copy code</button>
<br>
<div id="div5"><pre class="pchl"><code><span class="key">const</span> parentElement = document.getElementById(<span class="str">"parent-id"</span>);
<span class="key">const</span> childElements = Array.from(parentElement.children).filter(child =&gt; child.tagName === <span class="str">"tag-name"</span>);</code></pre>
</div>



<br><br><br>



<h3 class="wp-block-heading hLBRed" id="3-get-child-element-by-class"><strong>3. get child element by class</strong></h3>



<br>



<h4 class="wp-block-heading" id="a-query-selector-all-method"><strong>a. querySelectorAll() Method:</strong></h4>



<p class="custp1">This method returns a NodeList containing all elements in the document that match the specified class name. It is versatile and allows for more complex selectors using CSS syntax.</p>



<div><i><u>example 1:</u></i></div>



<button class="c-b-s-f-r" onclick="ctc('div6',this)">Copy code</button>
<br>
<div id="div6"><pre class="pchl"><code><span class="com">// Selecting child elements by class using querySelectorAll()</span>
<span class="key">const</span> elements = document.querySelectorAll(<span class="str">'.className'</span>);</code></pre>
</div>



<br>



<div><i><u>example 2:</u></i></div>



<button class="c-b-s-f-r" onclick="ctc('div7',this)">Copy code</button>
<br>
<div id="div7"><pre class="pchl"><code>&lt;div class=<span class="str">"parent"</span>&gt;
  &lt;div class=<span class="str">"child"</span>&gt;Child 1&lt;/div&gt;
  &lt;div class=<span class="str">"child"</span>&gt;Child 2&lt;/div&gt;
  &lt;div class=<span class="str">"child"</span>&gt;Child 3&lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
  <span class="com">// Retrieving child elements with class 'child'</span>
  <span class="key">const</span> elements = document.querySelectorAll(<span class="str">'.child'</span>);
  elements.<span class="key">forEach</span>(element =&gt; {
    console.log(element.textContent);
  });
&lt;/script&gt;</code></pre>
</div>



<br><br>



<h4 class="wp-block-heading" id="b-get-elements-by-class-name-method"><strong>b. getElementsByClassName() Method:</strong></h4>



<p class="custp1">This method returns a live HTMLCollection of elements with the given class name. It is faster than querySelectorAll() but has limited browser support for more complex selectors.</p>



<button class="c-b-s-f-r" onclick="ctc('div8',this)">Copy code</button>
<br>
<div id="div8"><pre class="pchl"><code><span class="com">// Selecting child elements by class using getElementsByClassName()</span>
<span class="key">const</span> elements = document.getElementsByClassName(<span class="str">'className'</span>);</code></pre>
</div>



<br><br><br>



<h3 class="wp-block-heading hLBRed" id="4-get-child-element-by-type"><strong>4. get child element by type</strong></h3>



<br>



<h4 class="wp-block-heading" id="a-query-selector"><strong>a. querySelector()</strong>:</h4>



<p class="custp1">This method is useful when you have the same class name with different element types inside the parent tag.</p>



<button class="c-b-s-f-r" onclick="ctc('div9',this)">Copy code</button>
<br>
<div id="div9"><pre class="pchl"><code>&lt;div class=<span class="str">"mainSection"</span>>
	&lt;div class=<span class="str">"subsec"</span>>Text1&lt;/div>
	&lt;span class=<span class="str">"subsec"</span>>Text2&lt;/span>
&lt;/div>

parentElement.querySelector(<span class="str">"span.subsec"</span>);
</code></pre>
</div>



<br><br>



<h4 class="wp-block-heading" id="b-query-selector-all-1"><strong>b. querySelectorAll(): </strong></h4>



<p class="custp1">This method returns a static NodeList of all elements in the document that match a specified CSS selector(s).</p>



<button class="c-b-s-f-r" onclick="ctc('div10',this)">Copy code</button>
<br>
<div id="div10"><pre class="pchl"><code><span class="com">// Selects all &lt;div&gt; elements</span>
<span class="key">const</span> elements = document.querySelectorAll(<span class="str">'div'</span>); </code></pre>
</div>



<div id="PageInAd1"></div>
<script>
fetch('/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<br><br><br>



<h2 class="wp-block-heading h2Cust1" id="get-child-element-using-j-query"><strong><strong>Get Child Element</strong></strong> <strong>Using jQuery</strong></h2>



<br><br>



<h3 class="wp-block-heading hLBRed" id="1-or-j-query"><strong>1. $() or jQuery():</strong></h3>



<p class="custp1">In jQuery, the dollar sign function ($) or the jQuery() function is used to select elements by their IDs.</p>



<button class="c-b-s-f-r" onclick="ctc('div11',this)">Copy code</button>
<br>
<div id="div11"><pre class="pchl"><code><span class="key">const</span> childElement = $(<span class="str">'#child'</span>);
<span class="com">// Or</span>
<span class="key">const</span> childElement = jQuery(<span class="str">'#child'</span>);</code></pre>
</div>



<br><br>



<h3 class="wp-block-heading hLBRed" id="2-find"><strong>2. find(): </strong></h3>



<p class="custp1">The find() method in jQuery searches for descendant elements within the selected elements. You can use it to retrieve child elements by tag name within a parent element selected using jQuery. </p>



<button class="c-b-s-f-r" onclick="ctc('div12',this)">Copy code</button>
<br>
<div id="div12"><pre class="pchl"><code><span class="key">const</span> childElement = $(<span class="str">'#parent'</span>).find(<span class="str">'#child'</span>);

<span class="key">const</span> childElements = $(<span class="str">"#parent-id"</span>).find(<span class="str">"tag-name"</span>);</code></pre>
</div>



<br><br>



<h3 class="wp-block-heading hLBRed" id="3-children-selector"><strong>3. Children Selector:</strong></h3>



<p class="custp1">jQuery also provides a children selector that selects all direct children of the specified parent element. By combining it with the tag selector, you can retrieve child elements by tag.</p>



<div><i><u>example 1:</u></i></div>



<button class="c-b-s-f-r" onclick="ctc('div13',this)">Copy code</button>
<br>
<div id="div13"><pre class="pchl"><code><span class="key">const</span> childElements = $(<span class="str">"#parent-id &gt; tag-name"</span>);</code></pre>
</div>



<br><div><i><u>example 2:</u></i></div>



<button class="c-b-s-f-r" onclick="ctc('div14',this)">Copy code</button>
<br>
<div id="div14"><pre class="pchl"><code><span class="com">// Using .children()</span>
<span class="key">const</span> children = $(<span class="str">'.parent'</span>).children();
console.log(children); <span class="com">// Outputs &#91;div, div, span]</span></code></pre>
</div>



<br><br>



<h3 class="wp-block-heading hLBRed" id="4-context-parameter-in"><strong>4. context Parameter in $():</strong></h3>



<p class="custp1">The $() function in jQuery accepts a second optional parameter called context, which specifies the context in which to search for elements. By passing the parent element as the context, you can limit the search to its descendants.</p>



<button class="c-b-s-f-r" onclick="ctc('div15',this)">Copy code</button>
<br>
<div id="div15"><pre class="pchl"><code><span class="key">const</span> parentElement = document.getElementById(<span class="str">"parent-id"</span>);
<span class="key">const</span> childElements = $(<span class="str">"tag-name"</span>, parentElement);</code></pre>
</div>



<br><br>



<h3 class="wp-block-heading hLBRed" id="5-loop-each-child-element"><strong>5. Loop each child element</strong></h3>



<p class="custp1">If children have many elements with the same class name then you can use for-each loop and get a specific node, as shown in the below example:</p>



<button class="c-b-s-f-r" onclick="ctc('div16',this)">Copy code</button>
<br>
<div id="div16"><pre class="pchl"><code>&lt;div class=<span class="str">"parent"</span>&gt;
  &lt;div class=<span class="str">"child"</span>&gt;Child 1&lt;/div&gt;
  &lt;div class=<span class="str">"child"</span>&gt;Child 2&lt;/div&gt;
  &lt;div class=<span class="str">"child"</span>&gt;Child 3&lt;/div&gt;
&lt;/div&gt;

&lt;script src="https://code.jquery.com/jquery-3.6.0.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
  // Retrieving child elements with class 'child' using jQuery
  $(<span class="str">'.child'</span>).<span class="key">each</span>(<span class="key">function</span>() {
    console.log($(this).text());
  });
&lt;/script&gt;</code></pre>
</div>



<div id="PageInAd2"></div>
<script>
fetch('/gads/PageInAd2.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd2').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd2:', error);
	});
</script>



<br><br>
<script src="/my-js/latesttop10post.js" type="text/javascript"></script>
<input type="hidden" id="cids" value="129,138,103,140,139,141">
<div id="latestPostlist"></div>
<br>



<br>



<div class="wp-block-rank-math-toc-block toc-cust" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#get-child-element-using-javascript">Get Child Element Using Javascript</a><ul><li><a href="#1-get-child-element-by-id">1. get child element by id</a><ul><li><a href="#a-get-element-by-id">a. getElementById():</a></li><li><a href="#b-query-selector">b. querySelector():</a></li></ul></li><li><a href="#2-get-child-element-by-tag">2. get child element by tag</a><ul><li><a href="#a-get-element-by-id-with-get-elements-by-tag-name">a. getElementById() with getElementsByTagName():</a></li><li><a href="#b-query-selector-all">b. querySelectorAll():</a></li><li><a href="#c-children-property">c. Children Property:</a></li></ul></li><li><a href="#3-get-child-element-by-class">3. get child element by class</a><ul><li><a href="#a-query-selector-all-method">a. querySelectorAll() Method:</a></li><li><a href="#b-get-elements-by-class-name-method">b. getElementsByClassName() Method:</a></li></ul></li><li><a href="#4-get-child-element-by-type">4. get child element by type</a><ul><li><a href="#a-query-selector">a. querySelector():</a></li><li><a href="#b-query-selector-all-1">b. querySelectorAll(): </a></li></ul></li></ul></li><li><a href="#get-child-element-using-j-query">Get Child Element Using jQuery</a><ul><li><a href="#1-or-j-query">1. $() or jQuery():</a></li><li><a href="#2-find">2. find(): </a></li><li><a href="#3-children-selector">3. Children Selector:</a></li><li><a href="#4-context-parameter-in">4. context Parameter in $():</a></li><li><a href="#5-loop-each-child-element">5. Loop each child element</a></li></ul></li></ul></nav></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codeindotnet.com/get-child-element-javascript-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Get Parent Element from Child &#8211; Javascript, jQuery</title>
		<link>https://www.codeindotnet.com/get-parent-element-javascript-jquery/</link>
					<comments>https://www.codeindotnet.com/get-parent-element-javascript-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 21 Feb 2024 03:29:58 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=6769</guid>

					<description><![CDATA[There might be a situation where you need to access the parent element of a particular child element in your web application. In this article, we will discuss several ways to get the parent element from a child element using Javascript and jQuery. Get Parent Id from Child Element Using Javascript Use parentNode or parentElement [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInHoriAd1"></div>
<script>
fetch('/gads/PageInHoriAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInHoriAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInHoriAd1:', error);
	});
</script>



<br>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="514" height="250" src="https://www.codeindotnet.com/wp-content/uploads/2024/02/get-parent-element-from-child.jpg" alt="Get Parent Element from Child using Javascript or jQuery" class="wp-image-6836" srcset="https://www.codeindotnet.com/wp-content/uploads/2024/02/get-parent-element-from-child.jpg 514w, https://www.codeindotnet.com/wp-content/uploads/2024/02/get-parent-element-from-child-300x146.jpg 300w" sizes="(max-width: 514px) 100vw, 514px" /></figure></div>


<br><br>



<p>There might be a situation where you need to access the parent element of a particular child element in your web application. In this article, we will discuss several ways to get the parent element from a child element using Javascript and jQuery.</p>



<br>



<h2 class="wp-block-heading h2Cust1" id="get-parent-id-from-child-element"><strong>Get Parent Id from Child Element</strong></h2>



<br><br>



<h2 class="wp-block-heading hLBRed" id="using-javascript"><strong>Using Javascript</strong></h2>



<br>



<p>Use parentNode or parentElement Property to get Parent element using javascript.</p>



<br>



<h3 class="wp-block-heading" id="1-parent-node-property"><strong>1. parentNode Property:</strong></h3>



<br>



<p>JavaScript provides a straightforward way to access the parent element through the <span class="spanHT">parentNode</span> property of the DOM node.</p>



<button class="c-b-s-f-r" onclick="ctc('div1',this)">Copy code</button>
<br>
<div id="div1">
<pre class="pchl"><code><span class="key">const</span> childElement = document.getElementById('childId');
<span class="key">const</span> parentElement = childId.parentNode;
</code></pre>
</div>



<br><br>



<h3 class="wp-block-heading" id="2-parent-element-property-for-modern-browsers"><strong>2. parentElement Property (for modern browsers):</strong></h3>



<br>



<p>Modern browsers also support the <span class="spanHT">parentElement</span> property, which is similar to <span class="spanHT">parentNode</span>.</p>



<button class="c-b-s-f-r" onclick="ctc('div2',this)">Copy code</button>
<br>
<div id="div2">
<pre class="pchl"><code><span class="key">const</span> childElement = document.getElementById('childId');
<span class="key">const</span> parentElement = childId.parentElement;
</code></pre>
</div>



<br><br>



<h3 class="wp-block-heading" id="example"><strong>Example:</strong></h3>



<br>



<div><b><i><u>.html file</u></i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div3',this)">Copy code</button>
<br>
<div id="div3">
<pre class="pchl"><code>&lt;html>
&lt;head>
<div style="background-color: #e7e7e76b;">&lt;script>
	document.addEventListener("DOMContentLoaded", () => {
		<span class="key">const</span> child = document.getElementById('childEle');

		child.addEventListener('click', <span class="key">function</span> childEleClick(event) {
			<span class="com">// &#x1f447; "parent"</span>
			console.log('child.parentElement.id = ' + child.parentElement.id);
			console.log('child.parentNode.id = ' + child.parentNode.id);
		});
	});
&lt;/script></div>
&lt;/head>

&lt;body>
<div style="background-color: #e7e7e76b;">	&lt;div id="parentEle">
		&lt;div id="childEle">
			Click me to get Parent element Id.
		&lt;/div>
	&lt;/div>
</div>
&lt;/body>
&lt;/html></code></pre>
</div>



<br><br>
<div><b><i><u>output screenshot</u></i></b></div>



<figure class="wp-block-image size-large"><img decoding="async" src="/img/1/get-parent-element-id.jpg" alt=""/></figure>



<div id="PageInAd1"></div>
<script>
fetch('/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<br><br><br>



<h2 class="wp-block-heading hLBRed" id="using-j-query"><strong>Using jQuery</strong></h2>



<br>



<p>In the same way, use the parent() or closest() method in jQuery to get the parent element.</p>



<br>



<h3 class="wp-block-heading" id="1-parent-method"><strong>1. parent() Method:</strong></h3>



<br>



<p>The <span class="spanHT">parent()</span> method retrieves the direct parent element of the selected child element.</p>



<button class="c-b-s-f-r" onclick="ctc('div4',this)">Copy code</button>
<br>
<div id="div4">
<pre class="pchl"><code><span class="key">const</span> parentElement = $('#childElementId').parent();
</code></pre>
</div>



<br><br>



<h3 class="wp-block-heading" id="2-closest-method"><strong>2. closest() Method:</strong></h3>



<br>



<p>If the parent element isn&#8217;t directly above the child, you can use the <span class="spanHT">closest()</span> method to find the nearest element that matches a specific selector.</p>



<button class="c-b-s-f-r" onclick="ctc('div5',this)">Copy code</button>
<br>
<div id="div5">
<pre class="pchl"><code><span class="key">const</span> parentElement = $('#childElementId').closest('.parentClass');
</code></pre>
</div>



<br><br><br><br>



<h2 class="wp-block-heading hLBRed" id="other-ways-to-get-the-parent-element"><strong>Other Ways to Get the Parent Element</strong></h2>



<br>



<p>If none of the solutions works out then you can try other tricks which are mentioned below:</p>



<br>



<h3 class="wp-block-heading" id="1-traversing-up-the-dom-tree"><strong>1. Traversing Up the DOM Tree:</strong></h3>



<br>



<p>You can move up the DOM tree yourself by using methods like parentNode or parentElement over and over again until you get to the parent element you want.</p>



<button class="c-b-s-f-r" onclick="ctc('div6',this)">Copy code</button>
<br>
<div id="div6">
<pre class="pchl"><code><span class="key">let</span> parentElement = childElement.parentNode;
<span class="key">while</span> (parentElement !== <span class="key">null</span>) {
    <span class="key">if</span> (parentElement.matches('.parentClass')) {
        <span class="key">break;</span>
    }
    parentElement = parentElement.parentNode;
}
</code></pre>
</div>



<br><br>



<h3 class="wp-block-heading" id="2-using-event-delegation"><strong>2. Using Event Delegation:</strong></h3>



<br>



<p>When working with event handling, especially in content that&#8217;s created dynamically, you can use event delegation to reach the parent element directly through the event object.</p>



<button class="c-b-s-f-r" onclick="ctc('div7',this)">Copy code</button>
<br>
<div id="div7">
<pre class="pchl"><code>document.addEventListener('click', <span class="key">function</span>(event) {
    <span class="key">const</span> parentElement = event.target.closest('.parentClass');
    <span class="com">// Perform actions with parentElement</span>
});
</code></pre>
</div>



<br>



<div id="PageInAd2"></div>
<script>
fetch('/gads/PageInAd2.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd2').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd2:', error);
	});
</script>



<br><br>



<br>
<script src="/my-js/latesttop10post.js" type="text/javascript"></script>
<input type="hidden" id="cids" value="129,138,103,140,139,141">
<div id="latestPostlist"></div>
<br>



<br>



<div class="wp-block-rank-math-toc-block toc-cust" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#using-javascript">Using Javascript</a><ul><li><a href="#1-parent-node-property">1. parentNode Property:</a></li><li><a href="#2-parent-element-property-for-modern-browsers">2. parentElement Property (for modern browsers):</a></li></ul></li><li><a href="#using-j-query">Using jQuery</a><ul><li><a href="#1-parent-method">1. parent() Method:</a></li><li><a href="#2-closest-method">2. closest() Method:</a></li></ul></li><li><a href="#other-ways-to-get-the-parent-element">Other Ways to Get the Parent Element</a><ul><li><a href="#1-traversing-up-the-dom-tree">1. Traversing Up the DOM Tree:</a></li><li><a href="#2-using-event-delegation">2. Using Event Delegation:</a></li></ul></li></ul></nav></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codeindotnet.com/get-parent-element-javascript-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Disable Input Field using jQuery or JavaScript</title>
		<link>https://www.codeindotnet.com/enable-disable-input-field-based-on-checkbox/</link>
					<comments>https://www.codeindotnet.com/enable-disable-input-field-based-on-checkbox/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 24 Nov 2023 15:28:27 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=6376</guid>

					<description><![CDATA[While performing front-end applications you may need to disable input fields dynamically based on certain conditions or user interactions. In this article, we&#8217;ll explore how to disable input fields using both jQuery and plain JavaScript, demonstrating practical examples with full HTML code. Disable Input Field when Checkbox is Checked using jQuery Let&#8217;s consider a simple [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInHoriAd1"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInHoriAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInHoriAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInHoriAd1:', error);
	});
</script>



<p>While performing front-end applications you may need to disable input fields dynamically based on certain conditions or user interactions. In this article, we&#8217;ll explore how to disable input fields using both jQuery and plain JavaScript, demonstrating practical examples with full HTML code.</p>



<br>



<h2 class="wp-block-heading h2Cust1" id="disable-input-field-when-checkbox-is-checked-using-j-query"><strong>Disable Input Field when Checkbox is Checked using jQuery</strong></h2>



<br>



<p>Let&#8217;s consider a simple form with a text input field and a checkbox. Below is the complete HTML code that demonstrates how to disable the text input when the checkbox is checked.</p>



<div><b><i><u>jQuery code snippet</u></i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div1',this)">Copy code</button>
<br>
<div id="div1">
<pre class="pchl"><code>$(document).ready(<span class="key">function</span>() {
	<span class="com">// Select the checkbox and input field</span>
	<span class="key">var</span> checkbox = $(<span class="str">'#disable-checkbox'</span>);
	<span class="key">var</span> inputField = $(<span class="str">'#text-input'</span>);

	<span class="com">// Disable input field initially if checkbox is checked on page load</span>
	inputField.prop(<span class="str">'disabled'</span>, checkbox.prop(<span class="str">'checked'</span>));

	<span class="com">// Bind a change event to the checkbox</span>
	checkbox.change(<span class="key">function</span>() {
		<span class="com">// Toggle the disabled property of the input field based on checkbox status</span>
		inputField.prop(<span class="str">'disabled'</span>, this.checked);
	});
});</code></pre>
</div>



<br><br>



<p>Full HTML code with jQuery. Copy &amp; paste it in Notepad and try it yourself.</p>



<div><b><i><u>.html file</u></i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div2',this)">Copy code</button>
<br>
<div id="div2">
<pre class="pchl"><code>&lt;!DOCTYPE html>
&lt;html lang="en">
&lt;head>
    &lt;meta charset="UTF-8">
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0">
    &lt;title>Disable Input Field Example&lt;/title>
    &lt;script src="https://code.jquery.com/jquery-3.6.4.min.js">&lt;/script>
    &lt;style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }

        label {
            display: block;
            margin-bottom: 10px;
        }
    &lt;/style>
&lt;/head>
&lt;body>

    &lt;h2>Disable Input Field - jQuery Example&lt;/h2>
	&lt;br>
    &lt;form>		
        &lt;label for="text-input">Text Input:
			&lt;input type="text" id="text-input" name="text-input">
		&lt;/label>

        &lt;label>
            &lt;input type="checkbox" id="disable-checkbox"> Disable Input
        &lt;/label>
    &lt;/form>

    &lt;script>
        $(document).ready(<span class="key">function</span>() {
            <span class="com">// Select the checkbox and input field</span>
            <span class="key">var</span> checkbox = $(<span class="str">'#disable-checkbox'</span>);
            <span class="key">var</span> inputField = $(<span class="str">'#text-input'</span>);

            <span class="com">// Disable input field initially if checkbox is checked on page load</span>
            inputField.prop(<span class="str">'disabled'</span>, checkbox.prop(<span class="str">'checked'</span>));

            <span class="com">// Bind a change event to the checkbox</span>
            checkbox.change(<span class="key">function</span>() {
                <span class="com">// Toggle the disabled property of the input field based on checkbox status</span>
                inputField.prop(<span class="str">'disabled'</span>, this.checked);
            });
        });
    &lt;/script>

&lt;/body>
&lt;/html>
</code></pre>
</div>



<br><br><br>



<h2 class="wp-block-heading h2Cust1" id="enable-disable-textbox-field-on-checkbox-click-using-javascript"><strong>Enable/ Disable Textbox Field on Checkbox Click using Javascript</strong></h2>



<br>



<p>You can achieve the same output using Javascript code. </p>



<div><b><i><u>JavaScript code snippet</u></i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div3',this)">Copy code</button>
<br>
<div id="div3">
<pre class="pchl"><code>document.addEventListener('DOMContentLoaded', <span class="key">function</span>() {
	<span class="com">// Select the checkbox and input field</span>
	<span class="key">var</span> checkbox = document.getElementById(<span class="str">'disable-checkbox'</span>);
	<span class="key">var</span> inputField = document.getElementById(<span class="str">'text-input'</span>);

	<span class="com">// Disable input field initially if checkbox is checked on page load</span>
	inputField.disabled = checkbox.checked;

	<span class="com">// Attach a change event to the checkbox</span>
	checkbox.addEventListener(<span class="str">'change'</span>, <span class="key">function</span>() {
		<span class="com">// Toggle the disabled property of the input field based on checkbox status</span>
		inputField.disabled = this.checked;
	});
});</code></pre>
</div>



<br><br>



<p>Here is the complete HTML code using jQuery. Just copy and paste it into Notepad and try it on your own. This example will produce the same result as well.</p>



<div><b><i><u>.html file</u></i></b></div>



<button class="c-b-s-f-r" onclick="ctc('div4',this)">Copy code</button>
<br>
<div id="div4">
<pre class="pchl"><code>&lt;!DOCTYPE html>
&lt;html lang="en">
&lt;head>
    &lt;meta charset="UTF-8">
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0">
    &lt;title>Disable Input Field Example&lt;/title>
    &lt;style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }

        label {
            display: block;
            margin-bottom: 10px;
        }
    &lt;/style>
&lt;/head>
&lt;body>

    &lt;h2>Disable Input Field - JavaScript Example&lt;/h2>
	&lt;br>
    &lt;form>
        &lt;label for="text-input">Text Input:        
			&lt;input type="text" id="text-input" name="text-input">
		&lt;/label>

        &lt;label>
            &lt;input type="checkbox" id="disable-checkbox"> Disable Input
        &lt;/label>
    &lt;/form>

    &lt;script>
        document.addEventListener('DOMContentLoaded', <span class="key">function</span>() {
            <span class="com">// Select the checkbox and input field</span>
            <span class="key">var</span> checkbox = document.getElementById(<span class="str">'disable-checkbox'</span>);
            <span class="key">var</span> inputField = document.getElementById(<span class="str">'text-input'</span>);

            <span class="com">// Disable input field initially if checkbox is checked on page load</span>
            inputField.disabled = checkbox.checked;

            <span class="com">// Attach a change event to the checkbox</span>
            checkbox.addEventListener(<span class="str">'change'</span>, <span class="key">function</span>() {
                <span class="com">// Toggle the disabled property of the input field based on checkbox status</span>
                inputField.disabled = this.checked;
            });
        });
    &lt;/script>

&lt;/body>
&lt;/html>
</code></pre>
</div>



<br><br>



<div class="hLBRed"><b><i><u>Output &#8211; screenshot:</u></i></b></div>



<figure class="wp-block-image size-full"><img decoding="async" width="327" height="201" src="https://www.codeindotnet.com/wp-content/uploads/2023/11/disable-input-field-on-checkbox-onclick-jquery-javascript.jpg" alt="disable input field on checkbox onclick jquery javascript" class="wp-image-6410" srcset="https://www.codeindotnet.com/wp-content/uploads/2023/11/disable-input-field-on-checkbox-onclick-jquery-javascript.jpg 327w, https://www.codeindotnet.com/wp-content/uploads/2023/11/disable-input-field-on-checkbox-onclick-jquery-javascript-300x184.jpg 300w" sizes="(max-width: 327px) 100vw, 327px" /></figure>



<div id="PageInAd1"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<br>
<script src="/my-js/latesttop10post.js" type="text/javascript"></script>
<input type="hidden" id="cids" value="129,138,103,140,139,141">
<div id="latestPostlist"></div>
<br>



<div class="wp-block-rank-math-toc-block toc-cust" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#disable-input-field-when-checkbox-is-checked-using-j-query">Disable Input Field when Checkbox is Checked using jQuery</a></li><li><a href="#enable-disable-textbox-field-on-checkbox-click-using-javascript">Enable/ Disable Textbox Field on Checkbox Click using Javascript</a></li></ul></nav></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codeindotnet.com/enable-disable-input-field-based-on-checkbox/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Take Top 10 Items from Data Array List Using JavaScript and jQuery</title>
		<link>https://www.codeindotnet.com/take-10-items-from-data-list-javascript-jquery/</link>
					<comments>https://www.codeindotnet.com/take-10-items-from-data-list-javascript-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 22 Sep 2023 18:01:17 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<category><![CDATA[slice method]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=5400</guid>

					<description><![CDATA[This post will demonstrate how to take the first 10 items from a data list using JavaScript and jQuery. You can use the slice method to get particular top items from the list. code snippet: var filterData = data.slice(0,10); Retrieving Top 10 Items from JSON Data List slice method using Javascript: The below javascript example [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInHoriAd1"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInHoriAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInHoriAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInHoriAd1:', error);
	});
</script>



<p class="custp1">This post will demonstrate how to take the first 10 items from a data list using JavaScript and jQuery. You can use the <span class="spanHT">slice</span> method to get particular top items from the list.</p>



<br>



<div><b><i><u>code snippet:</u></i></b></div>



<pre class="pchl"><code><span class="key">var</span> filterData = data<span style="background:#f2f19d;">.slice(0,10)</span>;</code></pre>



<br><br>



<h2 class="wp-block-heading h2Cust1"><strong>Retrieving Top 10 Items from JSON Data List</strong> </h2>



<br>



<h3 class="wp-block-heading hLBRed"><strong>slice method using Javascript:</strong></h3>



<p class="custp1">The below javascript example shows getting the top 10 items from the JSON response data list and assigning the result to another element.</p>



<pre class="pchl"><code>const response = <span class="key">await</span> fetch('URL');
const data = <span class="key">await</span> response.json();

<span class="com">// Get the first 10 items from the JSON data</span>
<span class="key">var</span> filterData = <span style="background:#f2f19d;">data.slice(0,10)</span>;

<span class="key">var</span> top10Result = "";

<span class="com">// Loop through and display the first 10 items</span>
filterData.forEach(obj =&gt; {
	top10Result += obj.name + ',';
 });
 
document.getElementById('item-list').innerHTML = top10Result;</code></pre>



<br><br>



<h3 class="wp-block-heading hLBRed"><strong>slice method using jQuery:</strong></h3>



<p class="custp1">The below jQuery example shows fetching 10 items from the JSON data:</p>



<pre class="pchl"><code>$(document).ready(<span class="key">function</span>() {

  <span class="com">// Your JSON data (replace with your actual data source)</span>
  <span class="key">var</span> jsonData = {
    "items": ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10", "Item 11", "Item 12" ]
  };

  <span class="com">// Get the first 10 items from the JSON data</span>
  <span class="key">var</span> first10Items = jsonData.items<span style="background:#f2f19d;">.slice(0, 10)</span>;

  <span class="com">// Loop through and display the first 10 items</span>
  for (<span class="key">var</span> i = 0; i &lt; first10Items.length; i++) {
    $("#item-list").append("&lt;li&gt;" + first10Items[i] + "&lt;/li&gt;");
  }
});
</code></pre>



<pre class="pchl"><code>&lt;ul id="item-list"&gt;
  &lt;!-- Items will be appended here --&gt;
&lt;/ul&gt;
</code></pre>



<br><div>In the code above, we:</div>



<ol class="wp-block-list">
<li>Define the JSON data (replace this with your actual JSON source).</li>



<li>Use the <span class="spanHT">slice</span> method to extract the first 10 items from the JSON array.</li>



<li>Loop through the extracted items and append them to an HTML element with the id &#8220;item-list.&#8221;</li>
</ol>



<div id="PageInAd1"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<br>



<div style="padding: 0.625rem 1.25rem 1.25rem 1.25rem; box-shadow: 0.0625rem 0.0625rem 0.9375rem 0rem lightgrey; margin-bottom: 1.25rem; border-radius: 0.625rem;">
<div><span style="border-bottom: 0.0625rem solid #cd5c5c; color:#cd5c5c;"><b><i>Latest:</i></b></span>
<div id="latestPostlist" style="padding-left:0.9375rem; padding-top:0.625rem; line-height: 1.9; font-weight:bold;"><div class="filter-list-item">&#8211; <a href="/remove-readonly-property-javascript-jquery/" target="_blank" rel="noopener">Removing the Readonly Property with JavaScript and jQuery</a></div><div class="filter-list-item">&#8211; <a href="/difference-between-window-onload-and-document-ready/" target="_blank" rel="noopener">Difference between window.onload and $(document).ready()</a></div><div class="filter-list-item">&#8211; <a href="/make-readonly-textbox-runtime/" target="_blank" rel="noopener">Switch Textbox to readonly in runtime</a></div><div class="filter-list-item">&#8211; <a href="/validate-password-with-regex-pattern-in-javascript/" target="_blank" rel="noopener">Validate Password with Regex Pattern in JS</a></div><div class="filter-list-item">&#8211; <a href="/remove-comma-using-javascript-or-jquery/" target="_blank" rel="noopener">Remove Comma in Javascript and jQuery</a></div><div class="filter-list-item">&#8211; <a href="/get-letters-alphabet-array-javascript/" target="_blank" rel="noopener">Create an Array of Alphabet characters in JavaScript</a></div><div class="filter-list-item">&#8211; <a href="/days-array-in-js-and-jquery/" target="_blank" rel="noopener">Days Array in JS and jQuery</a></div><div class="filter-list-item">&#8211; <a href="/remove-last-tr-tag-element-from-table/" target="_blank" rel="noopener">Remove last tr (row) from table &#8211; Javascript &amp; jQuery</a></div><div class="filter-list-item">&#8211; <a href="/months-array-list-in-javascript-and-jquery/" target="_blank" rel="noopener">How to access Months Array in Javascript and jQuery</a></div><div class="filter-list-item">&#8211; <a href="/remove-spaces-from-input-jquery-validation/" target="_blank" rel="noopener">Removing Spaces Validation from Input Field via jQuery</a></div></div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codeindotnet.com/take-10-items-from-data-list-javascript-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Removing the Readonly Property with JavaScript and jQuery</title>
		<link>https://www.codeindotnet.com/remove-readonly-property-javascript-jquery/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 14 Sep 2023 00:10:11 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<category><![CDATA[Remove Readonly textbox script]]></category>
		<category><![CDATA[removeAttr]]></category>
		<category><![CDATA[removeAttribute]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=5187</guid>

					<description><![CDATA[In web development, there are often situations where you need to allow users to edit input fields that are initially set as read-only. In this article, we will explore how to remove the readonly property from input fields using both plain JavaScript and jQuery, complete with HTML code examples. Javascript &#8211; Remove Readonly Property from [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInAd1"></div>
<script>

fetch('https://www.codeindotnet.com/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<p>In web development, there are often situations where you need to allow users to edit input fields that are initially set as read-only. In this article, we will explore how to remove the readonly property from input fields using both plain JavaScript and jQuery, complete with HTML code examples.</p>



<br>



<h2 class="wp-block-heading hLBRed"><strong><strong>Javascript</strong></strong> &#8211; <strong>Remove Readonly Property from textbox input</strong></h2>



<p class="custp1">In this example, we have a text input field with the ID &#8220;readonlyInput&#8221; and a button with the ID &#8220;removeReadonlyBtn&#8221; that we will use to trigger the removal of the readonly property.</p>



<p>To remove the readonly property using plain JavaScript, you can use the following script:</p>



<div><b><i><u>javascript example:</u></i></b></div>



<pre class="pchl"><code>&lt;html lang="en">
&lt;head>
    &lt;meta charset="UTF-8">

    &lt;title>Remove Readonly Property&lt;/title>
&lt;/head>
&lt;body>
    &lt;form>
        &lt;label for="readonlyInput">Readonly Input:&lt;/label>
        &lt;input type="text" id="readonlyInput" value="This input is readonly" readonly>
        &lt;button id="removeReadonlyBtn">Remove Readonly&lt;/button>
    &lt;/form>

    &lt;script>
	document.addEventListener('DOMContentLoaded', <span class="key">function</span> () {
		<span class="key">var</span> readonlyInput = document.getElementById('readonlyInput');
		<span class="key">var</span> removeReadonlyBtn = document.getElementById('removeReadonlyBtn');

		removeReadonlyBtn.addEventListener('click', <span class="key">function</span> () {
			<span style="background:#f2f19d;">readonlyInput.removeAttribute('readonly');</span>
		});
	});

    &lt;/script>

&lt;/body>
&lt;/html>
</code></pre>



<p>In this JavaScript code, we first wait for the DOM content to be fully loaded using the <strong>DOMContentLoaded </strong>event. Then, we retrieve references to the input field and the button using <strong>getElementById</strong>. When the button is clicked, we use the <span class="spanHT">removeAttribute</span> method to remove the &#8220;readonly&#8221; attribute from the input field, allowing users to edit its content.</p>



<br><br>



<h2 class="wp-block-heading hLBRed"><strong><strong>jQuery</strong></strong> &#8211; <strong>Remove Readonly Property <strong>from textbox input</strong></strong></h2>



<p class="custp1">You can achieve the same result with jQuery.</p>



<div><b><i><u>jquery example:</u></i></b></div>



<pre class="pchl"><code>&lt;!DOCTYPE html>
&lt;html lang="en">
&lt;head>
    &lt;meta charset="UTF-8">
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0">
    &lt;title>Remove Readonly Property&lt;/title>
&lt;/head>
&lt;body>
    &lt;form>
        &lt;label for="readonlyInput">Readonly Input:&lt;/label>
        &lt;input type="text" id="readonlyInput" value="This input is readonly" readonly>
        &lt;button id="removeReadonlyBtn">Remove Readonly&lt;/button>
    &lt;/form>

    	&lt;script src="https://code.jquery.com/jquery-3.6.0.min.js">&lt;/script>
	&lt;script>
	$(document).ready(<span class="key">function</span> () {
		$('#removeReadonlyBtn').click(<span class="key">function</span> () {
			<span style="background:#f2f19d;">$('#readonlyInput').removeAttr('readonly');</span>
		});
	});
	&lt;/script>


&lt;/body>
&lt;/html>
</code></pre>



<p>In this jQuery example, we first include the jQuery library from the Content Delivery Network (CDN). Then, we use the <strong>$(document).ready()</strong> function to ensure the DOM is fully loaded before attaching an event handler to the button with the ID &#8220;removeReadonlyBtn.&#8221; When the button is clicked, we use the <span class="spanHT">removeAttr</span> method to remove the &#8220;readonly&#8221; attribute from the input field.</p>



<div id="PageInAd2"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInAd2.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd2').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd2:', error);
	});
</script>



<div style="padding: 0.625rem 1.25rem 1.25rem 1.25rem; box-shadow: 0.0625rem 0.0625rem 0.9375rem 0rem lightgrey; margin-bottom: 1.25rem; border-radius: 0.625rem;">
	<div><span style="border-bottom: 0.0625rem solid #cd5c5c; color:#cd5c5c;"><b><i>popular readings:</i></b></span>
		<div style="padding-left:0.9375rem; padding-top:0.625rem; line-height: 1.9;">
			<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-spaces-from-input-jquery-validation/">Removing Spaces Validation from Input Field via jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/difference-between-window-location-href-and-window-location-replace-and-window-location-assign-in-javascript/">Difference between window.location.href, window.location.replace, and window.location.assign in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/get-letters-alphabet-array-javascript/">Get Letters Alphabet Array &#8211; Javascript (JS)</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/read-html-tags-from-url-as-text-in-javascript/">Read HTML Tags from URL as text file and insert them into an existing element &#8211; Javascript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/read-text-files-from-url-javascript-jquery/">Different Ways to Read Text Files from URLs using JavaScript and jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/check-ckeditor-version-in-javascript/">Check CKEditor Version in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/validate-password-with-regex-pattern-in-javascript/">Validate Password with Regex Pattern in JS</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/how-to-check-if-an-element-is-hidden-in-jquery/">How to check if an element is hidden in jQuery?</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/find-if-element-is-hidden-visible-javascript/">Javascript: find out if Element is hidden or visible</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/6-ways-to-redirect-to-another-page-javascript/">6 ways to redirect to another page in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/show-javascript-popup-in-page-using-html-div-element-css/">Show JavaScript Popup in a webpage using Div Elements &#038; CSS</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/difference-between-window-onload-and-document-ready/">Difference between window.onload and $(document).ready()</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/make-readonly-textbox-runtime/">Switch Textbox to readonly in runtime</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-comma-using-javascript-or-jquery/">Remove Comma in Javascript and jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/days-array-in-js-and-jquery/">Days Array in JS and jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-last-tr-tag-element-from-table/">Remove last tr (row) from table &#8211; Javascript &#038; jQuery</a></b></div>

		</div>
	</div>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Difference between window.onload and $(document).ready()</title>
		<link>https://www.codeindotnet.com/difference-between-window-onload-and-document-ready/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 12 Sep 2023 15:30:32 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<category><![CDATA[document.ready]]></category>
		<category><![CDATA[window.onload]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=5153</guid>

					<description><![CDATA[When working with JavaScript in web development, you often encounter situations where you need to ensure that your code runs when the web page is fully loaded and ready for manipulation. Two commonly used methods for achieving this are window.onload and document.ready. While both seem similar at first glance, they serve slightly different purposes and [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInAd1"></div>
<script>

fetch('https://www.codeindotnet.com/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<p>When working with JavaScript in web development, you often encounter situations where you need to ensure that your code runs when the web page is fully loaded and ready for manipulation. Two commonly used methods for achieving this are <span class="spanHT">window.onload</span> and <span class="spanHT">document.ready</span>. While both seem similar at first glance, they serve slightly different purposes and have distinct use cases. In this article, we&#8217;ll explore the differences between window.onload and document.ready functions and provide examples to illustrate their usage.</p>



<br>



<h2 class="wp-block-heading hLBRed"><strong>Key Differences (window.onload vs document.ready</strong>)</h2>



<ol class="wp-block-list">
<li class="custp1"><strong>Timing</strong>: The main difference between the two is the timing of execution. <span class="spanHT">window.onload</span> waits for the entire page and all external resources to load, while <span class="spanHT">document.ready</span> (or <span class="spanHT">DOMContentLoaded</span>) fires as soon as the DOM is ready for manipulation.</li>



<li class="custp1"><strong>Dependency</strong>: Use <span class="spanHT">window.onload</span> when your code relies on external resources like images and stylesheets that need to be fully loaded. Use <span class="spanHT">document.ready</span> (or <span class="spanHT">DOMContentLoaded</span>) when your code doesn&#8217;t depend on external assets and can be executed once the DOM is ready.</li>
</ol>



<br>



<h2 class="wp-block-heading hLBRed"><strong>window.onload &#8211; Javascript</strong></h2>



<p class="custp1">The <strong>window.onload</strong> is the built-in JavaScript event that is fired when the entire web page, including all its content (images, stylesheets, scripts, etc.), has been fully loaded. It indicates that the DOM (Document Object Model) and all external resources have been completely processed. Any code specified within the window.onload event handler will run only after the entire page has loaded.</p>



<p>Here&#8217;s an example of how to use <strong>window.onload</strong>:</p>



<pre class="pchl"><code>&lt;!DOCTYPE html>
&lt;html>
&lt;head>
    &lt;title>Window.onload Example&lt;/title>
&lt;/head>
&lt;body>
    &lt;h1>Hello, World!&lt;/h1>

    &lt;script>
        <span style="background:#f2f19d;">window.onload</span> = <span class="key">function</span>() {
            // Code to be executed after the entire page has loaded
            alert('Window is fully loaded');
        };
    &lt;/script>
&lt;/body>
&lt;/html>
</code></pre>



<p>In this example, the JavaScript code within the <span class="spanHT">window.onload</span> event handler will display an alert only after the entire page, including the <span class="spanHT">&lt;h1&gt;</span> element, has finished loading.</p>



<br>



<h2 class="wp-block-heading hLBRed"><strong>document.ready &#8211; jQuery</strong></h2>



<p class="custp1">On the other hand, the <strong>document.ready</strong> function is a concept primarily associated with the jQuery library, although similar functionality can be achieved with vanilla JavaScript using the <strong>DOMContentLoaded </strong>event. The <span class="spanHT">document.ready</span> (or DOMContentLoaded) event is triggered as soon as the DOM is ready for manipulation, even before external resources like images are fully loaded. This makes it ideal for executing code that doesn&#8217;t depend on external assets.</p>



<p>Here&#8217;s an example of how to use <strong>document.ready</strong> with jQuery:</p>



<pre class="pchl"><code>&lt;!DOCTYPE html>
&lt;html>
&lt;head>
    &lt;title>Document.ready Example&lt;/title>
    &lt;script src="https://code.jquery.com/jquery-3.6.0.min.js">&lt;/script>
&lt;/head>
&lt;body>
    &lt;h1>Hello, World!&lt;/h1>

    &lt;script>
        <span style="background:#f2f19d;">$(document).ready</span>(<span class="key">function</span>() {
            // Code to be executed as soon as the DOM is ready
            alert('DOM is ready');
        });
    &lt;/script>
&lt;/body>
&lt;/html>
</code></pre>



<p>In this jQuery example, the alert will be displayed as soon as the DOM is ready, which means it will appear before any external resources have finished loading.</p>



<div id="PageInAd2"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInAd2.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd2').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd2:', error);
	});
</script>



<br>
<div style="padding: 0.625rem 1.25rem 1.25rem 1.25rem; box-shadow: 0.0625rem 0.0625rem 0.9375rem 0rem lightgrey; margin-bottom: 1.25rem; border-radius: 0.625rem;">
	<div><span style="border-bottom: 0.0625rem solid #cd5c5c; color:#cd5c5c;"><b><i>popular readings:</i></b></span>
		<div style="padding-left:0.9375rem; padding-top:0.625rem; line-height: 1.9;">
			<div><b>&#8211; <a href="https://www.codeindotnet.com/hide-scroll-indicator-in-react-native/">How to hide Scroll Indicator in React Native</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-spaces-from-input-jquery-validation/">Removing Spaces Validation from Input Field via jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/difference-between-window-location-href-and-window-location-replace-and-window-location-assign-in-javascript/">Difference between window.location.href, window.location.replace, and window.location.assign in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/get-letters-alphabet-array-javascript/">Get Letters Alphabet Array &#8211; Javascript (JS)</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/read-html-tags-from-url-as-text-in-javascript/">Read HTML Tags from URL as text file and insert them into an existing element &#8211; Javascript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/read-text-files-from-url-javascript-jquery/">Different Ways to Read Text Files from URLs using JavaScript and jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/check-ckeditor-version-in-javascript/">Check CKEditor Version in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/validate-password-with-regex-pattern-in-javascript/">Validate Password with Regex Pattern in JS</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/how-to-check-if-an-element-is-hidden-in-jquery/">How to check if an element is hidden in jQuery?</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/find-if-element-is-hidden-visible-javascript/">Javascript: find out if Element is hidden or visible</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/6-ways-to-redirect-to-another-page-javascript/">6 ways to redirect to another page in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/show-javascript-popup-in-page-using-html-div-element-css/">Show JavaScript Popup in a webpage using Div Elements &#038; CSS</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/make-readonly-textbox-runtime/">Switch Textbox to readonly in runtime</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-comma-using-javascript-or-jquery/">Remove Comma in Javascript and jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/days-array-in-js-and-jquery/">Days Array in JS and jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-last-tr-tag-element-from-table/">Remove last tr (row) from table &#8211; Javascript &#038; jQuery</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/months-array-list-in-javascript-and-jquery/">How to access Months Array in Javascript and jQuery</a></b></div>

		</div>
	</div>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Switch Textbox to readonly in runtime</title>
		<link>https://www.codeindotnet.com/make-readonly-textbox-runtime/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 06 Sep 2023 08:11:29 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=4872</guid>

					<description><![CDATA[You can toggle the textbox to read-only or editable mode by using its readOnly property. jquery code snippet: textbox.prop("readonly", true); javascript code snippet: textbox.readOnly = true; Make textbox readonly &#8211; Full HTML &#38; Scripts Here&#8217;s a complete HTML code example that changes the behavior of textbox based on readonly property. You can use either jQuery [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInAd1"></div>
<script>

fetch('https://www.codeindotnet.com/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<p class="custp1">You can toggle the <span class="spanHT">textbox</span> to read-only or editable mode by using its <span class="spanHT">readOnly</span> property.</p>



<h4 class="wp-block-heading"><strong><em><span style="text-decoration: underline;">jquery code snippet:</span></em></strong></h4>



<pre class="pchl"><code>textbox.prop("readonly", <span class="key">true</span>);</code></pre>



<br>



<h4 class="wp-block-heading"><strong><em><span style="text-decoration: underline;">javascript code snippet:</span></em></strong></h4>



<pre class="pchl"><code>textbox.readOnly = <span class="key">true</span>;</code></pre>



<br><br>



<h2 class="h2Cust1"><b>Make textbox readonly &#8211; Full HTML &amp; Scripts</b></h2>



<p class="custp1">Here&#8217;s a complete HTML code example that changes the behavior of textbox based on <span class="spanHT">readonly</span> property. You can use either jQuery or Javascript:</p>



<h2 class="wp-block-heading"><strong>HTML Structure:</strong></h2>



<pre class="pchl"><code>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Readonly Textbox Example&lt;/title&gt;
    &lt;link rel="stylesheet" href="styles.css"&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div class="container"&gt;
        &lt;h1&gt;Readonly Textbox Example&lt;/h1&gt;
        &lt;label for="readonly-textbox"&gt;Readonly Textbox:&lt;/label&gt;
        &lt;input type="text" id="readonly-textbox" value="This is a readonly textbox"&gt;
        &lt;button id="make-readonly"&gt;Make Readonly&lt;/button&gt;
        &lt;button id="make-editable"&gt;Make Editable&lt;/button&gt;
    &lt;/div&gt;

    &lt;script src="jquery.min.js"&gt;&lt;/script&gt;
    &lt;script src="script.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>



<br>



<h2 class="wp-block-heading"><strong>CSS (styles.css):</strong></h2>



<pre class="pchl"><code>.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

input[type="text"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
}

button {
    padding: 10px 20px;
    margin: 10px;
    cursor: pointer;
}
</code></pre>



<br>



<h2 class="wp-block-heading"><strong><strong>Using JQuery (script.js)</strong></strong></h2>



<pre class="pchl"><code>$(document).ready(<span class="key">function()</span> {
    <span class="com">// Get a reference to the textbox</span>
    <span class="key">var</span> textbox = $("#readonly-textbox");

    <span class="com">// Make the textbox readonly</span>
    $("#make-readonly").click(<span class="key">function()</span> {
        textbox<span style="background:#f2f19d;">.prop("readonly", <span class="key">true</span>);</span>
    });

    <span class="com">// Make the textbox editable</span>
    $("#make-editable").click(<span class="key">function</span>() {
        textbox<span style="background:#f2f19d;">.prop("readonly", <span class="key">false</span>);</span>
    });
});
</code></pre>



<p>we use jQuery to handle the click events of the &#8220;Make Readonly&#8221; and &#8220;Make Editable&#8221; buttons. When the &#8220;Make Readonly&#8221; button is clicked, we set the <span class="spanHT">readonly</span> property of the textbox to <span class="spanHT">true</span>, making it readonly. When the &#8220;Make Editable&#8221; button is clicked, we set the <span class="spanHT">readonly</span> property to <span class="spanHT">false</span>, allowing the user to edit the textbox.</p>



<br>



<h2 class="wp-block-heading"><strong>Using Javascript (script.js)</strong></h2>



<pre class="pchl"><code>document.addEventListener("DOMContentLoaded", <span class="key">function</span>() {
    <span class="com">// Get a reference to the textbox</span>
    <span class="key">var</span> textbox = document.getElementById("readonly-textbox");

    <span class="com">// Get references to the buttons</span>
    <span class="key">var</span> makeReadonlyButton = document.getElementById("make-readonly");
    <span class="key">var</span> makeEditableButton = document.getElementById("make-editable");

    <span class="com">// Function to make the textbox readonly</span>
    <span class="key">function</span> makeReadonly() {
        textbox<span style="background:#f2f19d;">.readOnly = <span class="key">true</span>;</span>
    }

    <span class="com">// Function to make the textbox editable</span>
    <span class="key">function</span> makeEditable() {
        textbox<span style="background:#f2f19d;">.readOnly = <span class="key">false</span>;</span>
    }

    <span class="com">// Attach click event handlers to the buttons</span>
    makeReadonlyButton.addEventListener("click", makeReadonly);
    makeEditableButton.addEventListener("click", makeEditable);
});
</code></pre>



<p>This JavaScript code achieves the same functionality &#8211; It uses the <span class="spanHT">addEventListener</span> method to attach click event handlers to the &#8220;Make Readonly&#8221; and &#8220;Make Editable&#8221; buttons and updates the <span class="spanHT">readOnly</span> property of the textbox accordingly.</p>



<div id="PageInAd2"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInAd2.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd2').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd2:', error);
	});
</script>



<br>
<div style="padding: 0.625rem 1.25rem 1.25rem 1.25rem; box-shadow: 0.0625rem 0.0625rem 0.9375rem 0rem lightgrey; margin-bottom: 1.25rem; border-radius: 0.625rem;">
	<div><span style="border-bottom: 0.0625rem solid #cd5c5c; color:#cd5c5c;"><b><i>popular readings:</i></b></span>
		<div style="padding-left:0.9375rem; padding-top:0.625rem; line-height: 1.9;">
			<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-spaces-from-input-jquery-validation/">Removing Spaces Validation from Input Field via jQuery</a></b></div><div><b>&#8211; <a href="https://www.codeindotnet.com/difference-between-window-location-href-and-window-location-replace-and-window-location-assign-in-javascript/">Difference between window.location.href, window.location.replace, and window.location.assign in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/get-letters-alphabet-array-javascript/">Get Letters Alphabet Array &#8211; Javascript (JS)</a></b></div><div><b>&#8211; <a href="https://www.codeindotnet.com/read-html-tags-from-url-as-text-in-javascript/">Read HTML Tags from URL as text file and insert them into an existing element &#8211; Javascript</a></b></div><div><b>&#8211; <a href="https://www.codeindotnet.com/read-text-files-from-url-javascript-jquery/">Different Ways to Read Text Files from URLs using JavaScript and jQuery</a></b></div><div><b>&#8211; <a href="https://www.codeindotnet.com/check-ckeditor-version-in-javascript/">Check CKEditor Version in JavaScript</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/hide-scroll-indicator-in-react-native/">How to hide Scroll Indicator in React Native</a></b></div>
<div><b>&#8211; <a href="https://www.codeindotnet.com/remove-comma-using-javascript-or-jquery/">Remove Comma in Javascript and jQuery</a></b></div><div><b>&#8211; <a href="https://www.codeindotnet.com/days-array-in-js-and-jquery/">Days Array in JS and jQuery</a></b></div><div><b>&#8211; <a href="https://www.codeindotnet.com/remove-last-tr-tag-element-from-table/">Remove last tr (row) from table &#8211; Javascript &#038; jQuery</a></b></div><div><b>&#8211; <a href="https://www.codeindotnet.com/months-array-list-in-javascript-and-jquery/">How to access Months Array in Javascript and jQuery</a></b></div>

		</div>
	</div>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Remove Comma in Javascript and jQuery</title>
		<link>https://www.codeindotnet.com/remove-comma-using-javascript-or-jquery/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 02 Sep 2023 14:25:18 +0000</pubDate>
				<category><![CDATA[Javascript JQuery Examples]]></category>
		<guid isPermaLink="false">https://www.codeindotnet.com/?p=4824</guid>

					<description><![CDATA[The below code shows how to remove all commas from the input string. Using Javascript javascript code snippet/ example // Using String replace() method var originalString = "1,000,000"; var stringWithoutCommas = originalString.replace(/,/g, ''); console.log(stringWithoutCommas); // Output: "1000000" In this example, we use the replace() method with a regular expression /,/g to match all commas in [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="PageInAd1"></div>
<script>

fetch('https://www.codeindotnet.com/gads/PageInAd1.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd1').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd1:', error);
	});
</script>



<p>The below code shows how to remove all commas from the input string.</p>



<h2 class="wp-block-heading"><strong>Using Javascript</strong></h2>



<br><div><b><i><u>javascript code snippet/ example</u></i></b></div>



<pre class="pchl"><code>// Using String replace() method
<span class="key">var</span> originalString = "1,000,000";
<span class="key">var</span> stringWithoutCommas = originalString<span style="background:#f2f19d;">.replace(/,/g, '')</span>;

console.log(stringWithoutCommas); // Output: "1000000"
</code></pre>



<p>In this example, we use the <span class="spanHT">replace()</span> method with a regular expression <span class="spanHT">/,/g</span> to match all commas in the string and replace them with an empty string.</p>



<br>



<h2 class="wp-block-heading"><strong>Using jQuery</strong></h2>



<br><div><b><i><u>jquery code snippet/ example</u></i></b></div>



<pre class="pchl"><code>&lt;!DOCTYPE html>
&lt;html>
&lt;head>
    &lt;script src="https://code.jquery.com/jquery-3.6.0.min.js">&lt;/script>
&lt;/head>
&lt;body>
    &lt;p id="text">1,000,000&lt;/p>
    &lt;script>
        $(document).ready(<span class="key">function()</span> {
            <span class="key">var</span> originalText = $('#text').text();
            <span class="key">var</span> textWithoutCommas = originalText<span style="background:#f2f19d;">.replace(/,/g, '')</span>;
            $('#text').text(textWithoutCommas);
        });
    &lt;/script>
&lt;/body>
&lt;/html>
</code></pre>



<p>In this jQuery example, we select the element with the ID &#8220;text,&#8221; retrieve its content using <span class="spanHT">text()</span>, remove commas using <span class="spanHT">replace()</span>, and then set the modified text back to the element using <span class="spanHT">text()</span> again.</p>



<div id="PageInAd2"></div>
<script>
fetch('https://www.codeindotnet.com/gads/PageInAd2.txt')
	.then(response => response.text())
	.then(text => {
		document.getElementById('PageInAd2').innerHTML = text;
	})
	.catch(error => {
		console.error('Error fetching manual PageInAd2:', error);
	});
</script>



<br>



<div style="padding: 0.625rem 1.25rem 1.25rem 1.25rem; box-shadow: 0.0625rem 0.0625rem 0.9375rem 0rem lightgrey; margin-bottom: 1.25rem; border-radius: 0.625rem;">
	<div><span style="border-bottom: 0.0625rem solid #cd5c5c; color:#cd5c5c;"><b><i>popular readings:</i></b></span>
		<div style="padding-left:0.9375rem; padding-top:0.625rem; line-height: 1.9;">
			<div><b>&#8211; <a href="https://www.codeindotnet.com/get-letters-alphabet-array-javascript/" aria-current="page">Get Letters Alphabet Array</a></b></div>
			<div><b>– <a href="https://www.codeindotnet.com/remove-spaces-from-input-jquery-validation/">Removing Spaces Validation from Input Field via jQuery</a></b></div><div><b>– <a href="https://www.codeindotnet.com/difference-between-window-location-href-and-window-location-replace-and-window-location-assign-in-javascript/">Difference between window.location.href, window.location.replace, and window.location.assign in JavaScript</a></b></div>
<div><b>– <a href="https://www.codeindotnet.com/read-html-tags-from-url-as-text-in-javascript/">Read HTML Tags from URL as text file and insert them into an existing element – Javascript</a></b></div><div><b>– <a href="https://www.codeindotnet.com/read-text-files-from-url-javascript-jquery/">Different Ways to Read Text Files from URLs using JavaScript and jQuery</a></b></div><div><b>– <a href="https://www.codeindotnet.com/check-ckeditor-version-in-javascript/">Check CKEditor Version in JavaScript</a></b></div>
<div><b>– <a href="https://www.codeindotnet.com/how-to-check-if-an-element-is-hidden-in-jquery/">How to check if an element is hidden in jQuery?</a></b></div><div><b>– <a href="https://www.codeindotnet.com/find-if-element-is-hidden-visible-javascript/">Javascript: find out if Element is hidden or visible</a></b></div><div><b>– <a href="https://www.codeindotnet.com/6-ways-to-redirect-to-another-page-javascript/">6 ways to redirect to another page in JavaScript</a></b></div><div><b>– <a href="https://www.codeindotnet.com/show-javascript-popup-in-page-using-html-div-element-css/">Show JavaScript Popup in a webpage using Div Elements &amp; CSS</a></b></div><div><b>– <a href="https://www.codeindotnet.com/find-public-ip-address-via-javascript/">Easy way to find Public IP Address: Javascript Code</a></b></div>
<div><b>– <a href="https://www.codeindotnet.com/days-array-in-js-and-jquery/">Days Array in JS and jQuery</a></b></div><div><b>– <a href="https://www.codeindotnet.com/remove-last-tr-tag-element-from-table/">Remove last tr (row) from table – Javascript &amp; jQuery</a></b></div><div><b>– <a href="https://www.codeindotnet.com/months-array-list-in-javascript-and-jquery/">How to access Months Array in Javascript and jQuery</a></b></div>
		</div>
	</div>
</div>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
