<?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>getelementbyid Archives -</title>
	<atom:link href="https://mitindia.in/tag/getelementbyid/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/getelementbyid/</link>
	<description></description>
	<lastBuildDate>Sat, 07 Jan 2023 07:48:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>getelementbyid Archives -</title>
	<link>https://mitindia.in/tag/getelementbyid/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>java script events</title>
		<link>https://mitindia.in/java-script-events/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Sat, 07 Jan 2023 07:48:30 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[getelementbyid]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://www.mitindia.in/?p=1299</guid>

					<description><![CDATA[<p>The document.getElementById() returns an Element object representing the element whose id property matches the specified string. Following are example based on document.getElementById: Checkbox event demo &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;style&#62; body{background-image: linear-gradient(to bottom, green, lightgreen);background-repeat: no-repeat; color:white; border-radius: 20px;"} &#60;/style&#62; &#60;/head&#62; &#60;body&#62; &#60;h1 style="background-image: linear-gradient(to right, red, orange); color:white; border-radius: 20px;"&#62; Chose your educational qualification&#60;/h1&#62; [&#8230;]</p>
<p>The post <a href="https://mitindia.in/java-script-events/">java script events</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The document.getElementById() returns an Element object representing the element whose id property matches the specified string.</p>
<p>Following are example based on document.getElementById:</p>
<ol>
<li>Checkbox event demo</li>
</ol>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
    body{background-image: linear-gradient(to bottom, green, lightgreen);background-repeat: no-repeat; color:white; border-radius: 20px;"}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;h1 style="background-image: linear-gradient(to right, red, orange); color:white; border-radius: 20px;"&gt; Chose your educational qualification&lt;/h1&gt;


&lt;form&gt;
&lt;input type="checkbox" name="edu" value="Degree"&gt;Under Graduate&lt;br&gt;
&lt;input type="checkbox" name="edu" value="PostGraduate"&gt;Post Graduate &lt;br&gt;
&lt;input type="checkbox" name="edu" value="Diploma"&gt;Diploma &lt;br&gt;
&lt;br&gt;
&lt;input type="button" onclick="fun()" value="Show"&gt;

&lt;input type="text" id="print" size="50"&gt;
&lt;/form&gt;

&lt;script&gt;
function fun() {
  var e = document.forms[0];
  var txt = "";
  var i;
  for (i = 0; i &lt; e.length; i++) {
    if (e[i].checked) {
      txt = txt + e[i].value + " ";
    }
  }
  document.getElementById("print").value = "Your qualification: " + txt;
}
&lt;/script&gt;


&lt;p style="background-image: linear-gradient(to right, teal, white); color:black; text-align: justify;"&gt;
&lt;b&gt;Note: &lt;/b&gt;The Document method getElementById() returns an Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly. &lt;/p&gt; 
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Output of above code is:</p>
<p><img decoding="async" class="alignnone size-medium wp-image-1300" src="http://www.mitindia.in/wp-content/uploads/2023/01/checkdemo-300x83.png" alt="" width="300" height="83" srcset="https://mitindia.in/wp-content/uploads/2023/01/checkdemo-300x83.png 300w, https://mitindia.in/wp-content/uploads/2023/01/checkdemo-1024x283.png 1024w, https://mitindia.in/wp-content/uploads/2023/01/checkdemo-768x212.png 768w, https://mitindia.in/wp-content/uploads/2023/01/checkdemo.png 1346w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>2. Radio button event demo</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;title&gt;&lt;/title&gt;

&lt;style&gt;
    body{background-image: linear-gradient(to bottom, green, lightgreen);background-repeat: no-repeat; color:white; border-radius: 20px;"}
&lt;/style&gt;

&lt;script type="text/javascript"&gt;
    function r1() {
  var x = document.getElementById("cash").checked;
  document.getElementById("disp").innerHTML = "You selected :&lt;b&gt; Cash";
}

function r2() {
  var y = document.getElementById("upi").checked;
  document.getElementById("disp").innerHTML = "You selected : &lt;b&gt; UPI";
}

function r3() {
  var y = document.getElementById("net").checked;
  document.getElementById("disp").innerHTML = "You selected : &lt;b&gt; Net Banking";
}

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;center&gt;
&lt;h1 style="background-image: linear-gradient(to right, red, orange); color:white; border-radius: 20px;"&gt; Radio button with event &lt;/h1&gt;
Mode of Payment: 
&lt;input type="radio" name="mop" id="cash" value="Cash" onclick="r1()"&gt;Cash
&lt;input type="radio" name="mop" id="upi" value="UPI" onclick="r2()"&gt;UPI
&lt;input type="radio" name="mop" id="net" value="Net Banking" onclick="r3()"&gt;Net Banking

&lt;p id='disp'&gt; &lt;/p&gt;
&lt;br&gt;&lt;br&gt;
&lt;p style="background-image: linear-gradient(to right, green, lightgreen); color:white; border-radius: 20px;"&gt;MIT India &lt;/p&gt;


&lt;p style="background-image: linear-gradient(to right, gray, white); color:black; text-align: justify;"&gt;
&lt;b&gt;Note: &lt;/b&gt;The Document method getElementById() returns an Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly. &lt;/p&gt;


&lt;/body&gt;
&lt;/html&gt;</pre>
<p>output of above code is:</p>
<p><img decoding="async" class="alignnone size-medium wp-image-1301" src="http://www.mitindia.in/wp-content/uploads/2023/01/radioevent-300x89.png" alt="" width="300" height="89" srcset="https://mitindia.in/wp-content/uploads/2023/01/radioevent-300x89.png 300w, https://mitindia.in/wp-content/uploads/2023/01/radioevent-1024x304.png 1024w, https://mitindia.in/wp-content/uploads/2023/01/radioevent-768x228.png 768w, https://mitindia.in/wp-content/uploads/2023/01/radioevent.png 1334w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>3. Combo box event demo:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;title&gt;&lt;/title&gt;

&lt;style&gt;
    body{background-image: linear-gradient(to right, green, lightgreen);border-radius: 20px;"}
&lt;/style&gt;
&lt;script type="text/javascript"&gt;
   function fun() {
  var x = document.getElementById("mop").value;
  document.getElementById("disp").innerHTML ="Your mode of payment is &lt;b&gt;&lt;u&gt;"+ x;
}
 &lt;/script&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;center&gt;
&lt;h1 style="background-image: linear-gradient(to right, red, orange); color:white; border-radius: 20px;"&gt; Combo with event &lt;/h1&gt;
Mode of Payment: 
&lt;select id="mop"&gt;
&lt;option value="Cash"&gt; Cash &lt;/option&gt;
&lt;option value="UPI"&gt; UPI &lt;/option&gt;
&lt;option value="Net Banking"&gt; Net Banking &lt;/option&gt;
&lt;/select&gt;
&lt;input type="button" name="b1" value="Check" onclick="fun()"&gt;
&lt;p id='disp'&gt; &lt;/p&gt;
&lt;br&gt;&lt;br&gt;
&lt;p style="background-image: linear-gradient(to right, teal, lightgreen); color:white; border-radius: 20px;"&gt;MIT India &lt;/p&gt;

&lt;p style="background-image: linear-gradient(to right, white, green, white); color:black; text-align: justify;"&gt;
&lt;b&gt;Note: &lt;/b&gt;The Document method getElementById() returns an Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly. &lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p>output of above code is:</p>
<p><img decoding="async" class="alignnone size-medium wp-image-1302" src="http://www.mitindia.in/wp-content/uploads/2023/01/comboevent-300x76.png" alt="" width="300" height="76" srcset="https://mitindia.in/wp-content/uploads/2023/01/comboevent-300x76.png 300w, https://mitindia.in/wp-content/uploads/2023/01/comboevent-1024x259.png 1024w, https://mitindia.in/wp-content/uploads/2023/01/comboevent-768x194.png 768w, https://mitindia.in/wp-content/uploads/2023/01/comboevent.png 1325w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fjava-script-events%2F&amp;linkname=java%20script%20events" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fjava-script-events%2F&amp;linkname=java%20script%20events" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fjava-script-events%2F&#038;title=java%20script%20events" data-a2a-url="https://mitindia.in/java-script-events/" data-a2a-title="java script events"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/java-script-events/">java script events</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
