<?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-tips &#8211; Extreme Web Designs</title>
	<atom:link href="https://theextremewebdesigns.com/blog/tag/javascript-tips/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Fri, 17 May 2013 19:05:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">156673191</site>	<item>
		<title>JavaScript: Remove Space From String Examples</title>
		<link>https://theextremewebdesigns.com/blog/javascript-remove-space-between-string/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-remove-space-between-string/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 17 May 2013 19:05:17 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=3856</guid>

					<description><![CDATA[Do you wish to remove space from string using JavaScript? In this article, I am going to share examples on how you can remove space between string very easily. Read on to find out more. How To Remove Space From String Using JavaScript Let&#8217;s assume that we have a string with the word &#8220;S t [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Do you wish to remove space from string using JavaScript? In this article, I am going to share examples on how you can <em><strong>remove space between string</strong></em> very easily. Read on to find out more.</p>
<p><span id="more-3856"></span></p>
<h2>How To Remove Space From String Using JavaScript</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=3856" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s assume that we have a string with the word &#8220;S t r i n g&#8221;. Note that each letter of the word is separated by a space. Now we will remove the space between each of these letters.</p>
<h3>Example 1: Remove all spaces completely</h3>
<pre class="lang:xhtml decode:true">&lt;script type="text/javascript"&gt;

var original_str = "S t r i n g"

//Strips all spaces
var space_stripped_str = original_str.replace(/\s/g,'');

alert(space_stripped_str + ' &lt;---- Without spaces');

&lt;/script&gt;</pre>
<p>When you run the above code, you will see an alert that gives you the following output: &#8220;String&#8221;</p>
<h3>Example 2: Remove multiple spaces and replace them with single space</h3>
<pre class="lang:xhtml decode:true">&lt;script type="text/javascript"&gt;

var original_str2 = "S    t    r  in  g"
//Strips excessive white spaces i.e. retains only one space between each letter
var white_space_stripped_str = original_str2.replace(/\s+/g, ' ');

alert(white_space_stripped_str + ' &lt;---- With exactly one space between each letter in case each letter has multiple spaces');

&lt;/script&gt;</pre>
<h3>Example 3: Remove spaces completely (trim) from left of the string</h3>
<pre class="lang:xhtml decode:true">&lt;script type="text/javascript"&gt;

var original_str3 = "   This is a string"

//Strips all space to the left of the string
alert( original_str3.trimLeft() + ' &lt;--- Without any spaces on the left' );

&lt;/script&gt;</pre>
<h3>Example 4: Remove spaces completely (trim) from right of the string</h3>
<pre class="lang:xhtml decode:true">&lt;script type="text/javascript"&gt;

var original_str4 = "This is a string   "

//Strips all space to the right of the string
alert( original_str4.trimRight() + ' &lt;--- Without any spaces on the right' );

&lt;/script&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=3856" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>Isn&#8217;t that easy? Your Turn Now!</h5>
<p>Do you know of any other ways to <em><strong>remove spaces using JavaScript from a word or a string</strong></em>? Please feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-remove-space-between-string/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3856</post-id>	</item>
		<item>
		<title>Prepopulating Textarea With Hint Using JavaScript</title>
		<link>https://theextremewebdesigns.com/blog/textarea-hint-using-javascript/</link>
					<comments>https://theextremewebdesigns.com/blog/textarea-hint-using-javascript/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 16 May 2013 19:05:17 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=3852</guid>

					<description><![CDATA[Over the web, at one point of the time or the other, you may have seen websites in which a textarea shows some default value, such as &#8220;Enter your comments&#8221; and when you click inside of this textarea, this default value vanishes. This is default value is called a &#8220;Textarea Hint&#8221; as it serves the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Over the web, at one point of the time or the other, you may have seen websites in which a textarea shows some default value, such as &#8220;Enter your comments&#8221; and when you click inside of this textarea, this default value vanishes. This is default value is called a &#8220;Textarea Hint&#8221; as it serves the purpose of a hint and tells you what to do by doing so. Do you know how to make a textarea behave so? If not, then this article sis for you. In this article, I am going to share an easy way to <strong>show, disappear and again show textarea hint based upon whether an input is entered in it or not using JavaScript</strong>.</p>
<h2>How To Prepopulate Textarea With Custom Hint Using JavaScript</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=3852" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s assume that we have a textarea in a form on our page. Now instead of hardcoding the value inside it, we will populate the textarea hint based upon the onfocus and onblur events. Consider the following example:</p>
<h3>Example 1: Prepopulate Textarea with Hint and Lose Hint forever once any input has been entered or entered and removed</h3>
<pre class="lang:xhtml decode:true">&lt;textarea name="message1" cols="25" rows="5" id="area" onclick="document.getElementById('area').innerHTML='';" &gt;Enter your message here&lt;/textarea&gt;</pre>
<h3>Example 2: Prepopulate Textarea with Hint and Restore Default Hint even if the input has been entered  and removed</h3>
<pre class="lang:xhtml decode:true">&lt;textarea name="message2" cols="25" rows="5" id="message2" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"&gt;Enter your message here&lt;/textarea&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=3852" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it!</h5>
<p>Do you know of any other ways to <em><strong>show / hide textarea hint using JavaScript</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/textarea-hint-using-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3852</post-id>	</item>
		<item>
		<title>Javascript Jump To Div Examples</title>
		<link>https://theextremewebdesigns.com/blog/jump-to-div-using-javascript/</link>
					<comments>https://theextremewebdesigns.com/blog/jump-to-div-using-javascript/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 15 May 2013 19:05:56 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=3844</guid>

					<description><![CDATA[At times it might be desirable to jump to a specific div in a web page, just like a named anchor. If you don&#8217;t know what a named anchor is, in brief, it is a link within a page, rather than a link to a separate page. So, can we simulate the same behavior, for [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>At times it might be desirable to jump to a specific div in a web page, just like a named anchor. If you don&#8217;t know what a named anchor is, in brief, it is a link within a page, rather than a link to a separate page. So, can we simulate the same behavior, for a div? Yes, we can! In this article, I am going to share a very easy example of  <em><strong>jumping to a div using JavaScript on page load</strong></em>. Read on to find out more.</p>
<p><span id="more-3844"></span></p>
<h2>How To Jump To Div Using JavaScript</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=3844" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Let&#8217;s assume that we have few divs with ID &#8220;my_div1&#8221;, &#8220;my_div1&#8221; and &#8220;my_div3&#8221; in a page. my_div1 is filled with lot of empty space. So this means that to actually view the contents of my_div2, you would normally have to scroll down, once the page loads. Now instead of this, we  would like to actually jump to my_div2 immediately on the page load. Note that these are all divs and not named anchors. The following example code achieves this effect.</p>
<h3>Example:</h3>
<pre class="lang:xhtml decode:true">&lt;style type="text/css"&gt;
.new_div {
	background-color: #FFDF9D;
	border: 1px solid #F90;
}
&lt;/style&gt;

&lt;div id="my_div1" class="new_div"&gt;This is MY DIV 1
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;/div&gt;

&lt;div id="my_div2" class="new_div"&gt;This is MY DIV 2 --- You will directly start seeing this section instead of the My DIV 1 when the page loads. THis is because of the jump to div using the JavaScript code below.
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;

&lt;div id="my_div3" class="new_div"&gt;This is MY DIV 3&lt;/div&gt;

&lt;script language="javascript" type="text/javascript"&gt;
document.getElementById('my_div2').scrollIntoView();
&lt;/script&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=3844" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>Your Turn!</h5>
<p>Do you know of any other ways to <em><strong>jump to any desired div using JavaScript on page load</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jump-to-div-using-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3844</post-id>	</item>
		<item>
		<title>How To Check If Textbox Is Empty Using JavaScript</title>
		<link>https://theextremewebdesigns.com/blog/javascript-textbox-empty-how-to-check-if-textbox-is-empty-using-javascript/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-textbox-empty-how-to-check-if-textbox-is-empty-using-javascript/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 20 Jan 2013 07:24:26 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-demos]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=2037</guid>

					<description><![CDATA[If you have worked with forms, then you would know how important it is to process the form input to make sure that all the required information is filled out properly. In this article, I am going to share a very easy way that you can use to check if Textbox is Empty using JavaScript. How to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you have worked with forms, then you would know how important it is to process the form input to make sure that all the required information is filled out properly. In this article, I am going to share a very easy way that you can use to <em><strong>check if Textbox is Empty using JavaScript</strong></em>.</p>
<p><span id="more-2037"></span></p>
<h2>How to use JavaScript to Check If Textbox Is Empty?</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=2037" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>For this example, I am assuming that we have a Textbox in a form and we need to check if this textbox is empty or not when the &#8220;Check&#8221; button is clicked.</p>
<h3>Example: Check if Textbox has contents or if it is empty using JavaScript</h3>
<pre class="lang:xhtml decode:true" title="Example ">&lt;script Language="JavaScript"&gt;
&lt;!--
function check_blank()
{
// If the value of the textbox is empty, then show an alert
if (my_form.state.value == "")
{
alert("Please fill in State.");

// Focus the textbox so that user can fill it
my_form.state.focus();

// return false to stop further processing
return false;
}

// If state is not null continue processing
return true;
}
--&gt;
&lt;/script&gt;

&lt;form name="my_form" id="my_form" action="#" onsubmit="return check_blank();"&gt;
&lt;label for="state"&gt;State&lt;/label&gt;
&lt;input type="text" name="state" id="state" &gt;
&lt;input type="submit" value="Check"&gt;
&lt;/form&gt;</pre>
<p>Once you run the above code and click the &#8220;Check&#8221; button, the page will show an alert. If you enter something in it and then click the button, the form will quietly submit the info.</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=2037" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p><strong>Simple, isn&#8217;t it?</strong></p>
<p>Do you know of any other ways to use <strong><em>JavaScript to check if textbox is empty</em></strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-textbox-empty-how-to-check-if-textbox-is-empty-using-javascript/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2037</post-id>	</item>
		<item>
		<title>JavaScript Substring / jQuery Substring Examples</title>
		<link>https://theextremewebdesigns.com/blog/javascript-substring-jquery-substring-how-to-use-substring-in-javascript-jquery/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-substring-jquery-substring-how-to-use-substring-in-javascript-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 13 Jan 2013 02:26:51 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1970</guid>

					<description><![CDATA[In JavaScript, the substring() method extracts the characters from a string, between two specified indices, and returns the new sub string. So if you want to find out how to use Substring in JavaScript / jQuery, then this article is for you as the solution is the same.  Examples follow. So read on to find out [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In JavaScript, the substring() method extracts the characters from a string, between two specified indices, and returns the new sub string. So if you want to find out <em><strong>how to use Substring in JavaScript / jQuery</strong></em>, then this article is for you as the solution is the same.  Examples follow. So read on to find out more.<span id="more-1970"></span></p>
<h2>How to use Substring in JavaScript / jQuery</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1970" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>So as the definition says, substring() method extracts the characters from a string by extracting the characters in a string between &#8220;from&#8221; and &#8220;to&#8221;. This will exclude  the &#8220;to&#8221; itself.</p>
<p><strong>Example: Use Substring in jQuery/JavaScript</strong></p>
<pre class="lang:xhtml decode:true crayon-selected" title="JavaScript Substring / jQuery Substring | How to use Substring in JavaScript / jQuery">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Examples to use JavaScript Substring / jQuery Substring&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;script&gt;

var str="This is some custom text";
document.write(str.substring(6)); //O/P: s some custom text
document.write("&lt;br&gt;");

document.write(str.substring(4,1)); //O/P: his
document.write("&lt;br&gt;");

document.write(str.substring(4,4)); //O/P: 
document.write("&lt;br&gt;");

document.write(str.substring(4,10)); //O/P: is so
document.write("&lt;br&gt;");

document.write(str.substring(1,10)); //O/P: his is so
document.write("&lt;br&gt;");

document.write(str.substring(1,20)); //O/P: his is some custom 
document.write("&lt;br&gt;");

&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1970" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p><strong> That&#8217;s it!</strong></p>
<p>Do you know of any other ways to <strong>use substring using jQuery / JavaScript</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-substring-jquery-substring-how-to-use-substring-in-javascript-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1970</post-id>	</item>
		<item>
		<title>JavaScript Get Image Dimensions (Width &#038; Height) Examples</title>
		<link>https://theextremewebdesigns.com/blog/javascript-get-image-dimensions-get-image-width-height/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-get-image-dimensions-get-image-width-height/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 19 Jun 2012 17:12:14 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-demos]]></category>
		<category><![CDATA[javascript-get-image-dimensions]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=928</guid>

					<description><![CDATA[Have you ever wanted to get image dimensions using JavaScript? In this article, I am going to share an easy way to use JavaScript to get image dimensions (width &#38; height). How to use JavaScript to Get Image Dimensions (Width &#38; Height) Following is the complete HTML + JavaScript source code that shows how to get [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Have you ever wanted to get image dimensions using JavaScript? In this article, I am going to share an easy way to use <em><strong>JavaScript to get image dimensions (width &amp; height)</strong>.</em><span id="more-928"></span></p>
<h2>How to use JavaScript to Get Image Dimensions (Width &amp; Height)</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=928" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Following is the complete HTML + JavaScript source code that shows how to get the image dimensions (width &amp; height) when the page is loaded:</p>
<h3>Example: Get Image Width &amp; Height (dimensions) using JavaScript</h3>
<pre class="lang:xhtml decode:true">&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Javascript Get Image Dimensions&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;img src="images/banner.png" id="my_img" /&gt;

&lt;script type="text/javascript"&gt;

var img = document.getElementById('my_img');

var width = img.clientWidth;

var height = img.clientHeight;

alert( 'Width: ' + width + ' Height:' + height );

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>The given code assumes that there is an image with ID &#8220;my_img&#8221; and the dimensions of this image needs to be found. When the above code is executed, the page will alert the width and height of the image.</p>
<h4>Note</h4>
<p>The image has to be completely loaded in order to get it&#8217;s size, or the width &amp; height values are incorrectly shown as zero.</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=928" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it!</h5>
<p>Do you know of any other ways to <em><strong>find image width and height using JavaScript</strong></em>? Feel free to share by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-get-image-dimensions-get-image-width-height/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">928</post-id>	</item>
		<item>
		<title>Remove Iframe html using Javascript</title>
		<link>https://theextremewebdesigns.com/blog/remove-iframe-html-using-javascript/</link>
					<comments>https://theextremewebdesigns.com/blog/remove-iframe-html-using-javascript/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 24 Mar 2012 01:11:44 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=404</guid>

					<description><![CDATA[Let&#8221;s say that you are showing an iframe in a page. If you notice, you will see that the contents of the page will also be shown in the iframe by default. Using this simple 1 line trick, you can remove iframe html using javascript. How To Remove Iframe html using Javascript Example Let&#8217;s assume that [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Let&#8221;s say that you are showing an iframe in a page. If you notice, you will see that the contents of the page will also be shown in the iframe by default. Using this simple 1 line trick, you can <strong>remove iframe html using javascript</strong>.<span id="more-404"></span></p>
<h2>How To Remove Iframe html using Javascript Example</h2>
<p>Let&#8217;s assume that we have an IFrame with ID &#8220;myframe&#8221;. We can use the .setAttribute() method to completely remove the html contents from the Iframe.</p>
<h3>Example: Remove Iframe html using Javascript</h3>
<pre class="lang:xhtml decode:true">//HTML:

&lt;iframe id="myframe" src="http://www.google.com"&gt;&lt;/iframe&gt;

//Javascript:

document.getElementById( 'myframe' ).setAttribute( 'src', '' );</pre>
<p>When you use the above code in your own web page and run it, you will see the contents of the iframe cease to exist. Easy, eh?</p>
<h5>Your Turn!</h5>
<p>Do you know of any other ways of using <em><strong>JavaScript to remove iframe html</strong></em>? Feel free to share by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/remove-iframe-html-using-javascript/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">404</post-id>	</item>
		<item>
		<title>Javascript Add minutes to date Example</title>
		<link>https://theextremewebdesigns.com/blog/javascript-add-minutes-to-date/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-add-minutes-to-date/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 08 Mar 2012 06:18:03 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=363</guid>

					<description><![CDATA[In this article, I am going to discuss about Javascript: Add minutes to date i.e how to add any number of minutes to a date. Example to Add minutes to date using JavaScript Here is a simple example that shows how to add minutes to date using JavaScript: &#60;script language="javascript" type="text/javascript"&#62; //The current date var date = [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article, I am going to discuss about Javascript: Add minutes to date i.e how to add any number of minutes to a date.<span id="more-363"></span></p>
<h2>Example to Add minutes to date using JavaScript</h2>
<p>Here is a simple example that shows how to add minutes to date using JavaScript:</p>
<pre class="lang:xhtml decode:true crayon-selected">&lt;script language="javascript" type="text/javascript"&gt;
//The current date
var date = new Date ();
//New/future date
var new_date = new Date ( date );
//Minutes to add_action. Change this as required
var minutes = 60;
//Add the minutes to current date to arrive at the new date
new_date.setMinutes ( date.getMinutes() + minutes );
//Output the old + new date
document.write('Old Date: ' + date + '&lt;br /&gt; New Date:' + new_date);
//Output is:
//Old Date: Thu Mar 08 2012 11:42:11
//New Date: Thu Mar 08 2012 12:42:11
//Note: The above values also shows the Timezone, but I have removed it for simplicity from the example

//If you do not want to show the current date but need to show only the new date, then this can be further simplified as:
var revised_date = new Date();
revised_date.setMinutes(revised_date.getMinutes() + minutes);
document.write('&lt;br /&gt; ' + revised_date);
//Output is Thu Mar 08 2012 12:42:11
&lt;/script&gt;</pre>
<h5>Simple, isnt&#8217; it?</h5>
<p>Do you know of any other ways to <strong>Add minutes to date  using JavaScript</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-add-minutes-to-date/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">363</post-id>	</item>
		<item>
		<title>Javascript Check If A Value Is In An Array Examples</title>
		<link>https://theextremewebdesigns.com/blog/javascript-check-if-a-value-is-in-an-array/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-check-if-a-value-is-in-an-array/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 05 Mar 2012 00:53:19 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=344</guid>

					<description><![CDATA[It&#8217;s relatively very easy in Javascript to check if a value is in an array. All you need is the array that you want to check and the value that you want to check against. That&#8217;s it. Using just those 2 pieces of information, you can easily check if a value is in an array [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s relatively very easy in Javascript to check if a value is in an array. All you need is the array that you want to check and the value that you want to check against. That&#8217;s it. Using just those 2 pieces of information, you can <em><strong>easily check if a value is in an array or not using JavaScript</strong></em>. Read on to find out more.<span id="more-344"></span></p>
<h2>How to use Javascript to Check if a value is in an array &#8211; Examples</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=344" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h3>Example 1: Here is the full JavaScript code you need to check if a value is in an array or not:</h3>
<pre class="lang:js decode:true">my_array = Array();

//To find if a value or element exists in an array
if (my_array.indexOf(‘find_this_value’) != -1)
{
alert(‘Value exists in array.’);
}

//To find if a value or element DOES NOT exist in an array
if (my_array.indexOf(‘find_this_value’) == -1)
{
alert(‘Value does not exist in array.’);
}</pre>
<h3>Example 2: Check whether a string is a part of an array value i.e. match a string with just part of the array value</h3>
<pre class="lang:js decode:true" title="Check whether a string is a part of an array value i.e. match a string with just part of the array value">function search_for_string_in_array(search_for_string, array_to_search) 
{
    for (var i=0; i&lt;array_to_search.length; i++) 
	{
        if (array_to_search[i].match(search_for_string))
		{ 
			return 'Value exists in array';
		}
    }

    return 'Value does NOT exist in array';
}

var my_array = ["test one", "test two", "test three"];

alert( search_for_string_in_array ('two', my_array) );</pre>
<p>Simply pass the value to search for and the array to the function and it will tell you whether the string exists as a part of an array value or not.</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=344" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h4>Simple, isn&#8217;t it?</h4>
<p>Do you know of any other way to <em><strong>check  if a value or an element exists in an array or not in JavaScript</strong></em>? If yes, please share your tips with us by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-check-if-a-value-is-in-an-array/feed/</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">344</post-id>	</item>
		<item>
		<title>Javascript: Detect iPhone, iPod, iPad</title>
		<link>https://theextremewebdesigns.com/blog/javascript-detect-iphone-ipod-ipad/</link>
					<comments>https://theextremewebdesigns.com/blog/javascript-detect-iphone-ipod-ipad/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 04 Feb 2012 02:48:39 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[javascript-snippets]]></category>
		<category><![CDATA[javascript-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=161</guid>

					<description><![CDATA[Have ever ever thought of display custom information to the user or making changes in the browser depending upon whether the user is using iPhone, iPod or iPad? Here is a snippet in Javascript: Detect iPhone, iPod, iPad using this handy snippet! How to Detect iPhone, iPod, iPad using JavaScript &#8211; Examples Insert the following snippet [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Have ever ever thought of display custom information to the user or making changes in the browser depending upon whether the user is using iPhone, iPod or iPad? Here is a snippet in Javascript: Detect iPhone, iPod, iPad using this handy snippet!<span id="more-161"></span></p>
<h2>How to Detect iPhone, iPod, iPad using JavaScript &#8211; Examples</h2>
<p>Insert the following snippet just above your &lt;/head&gt; tag:</p>
<pre class="lang:js decode:true">&lt;script type="text/javascript"&gt;
//Make your JS compatible by using the following tags
//&lt;![CDATA[

// Apple detection object
var Apple = {};
Apple.UA = navigator.userAgent;
Apple.Device = false;
Apple.Types = ["iPhone", "iPod", "iPad"];
for (var d = 0; d &lt; Apple.Types.length; d++) {
var t = Apple.Types[d];
Apple[t] = !!Apple.UA.match(new RegExp(t, "i"));
Apple.Device = Apple.Device || Apple[t];
}
// is this an Apple device?
/*alert(
"Apple device? " + Apple.Device +
"\niPhone? " + Apple.iPhone +
"\niPod? " + Apple.iPod +
"\niPad? " + Apple.iPad
);*/
if ( true == Apple.iPhone )
{
 //do this
}
else  if ( true == Apple.iPod )
{
//do this
}
else  if ( true == Apple.iPad )
{
//do this
}

//]]&gt;
&lt;/script&gt;</pre>
<h5>That&#8217;s it!</h5>
<p>Did you like this post? Do you know of any other ways to <strong>detect iPhone, iPod, iPad using JavaScript</strong>? Feel free to suggest by commenting below. We would love to hear from you.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/javascript-detect-iphone-ipod-ipad/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">161</post-id>	</item>
	</channel>
</rss>
