<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1889032152054434804</id><updated>2024-10-20T10:51:55.604+05:30</updated><title type='text'>vallab</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://csharpvallab.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1889032152054434804/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://csharpvallab.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Vallab</name><uri>http://www.blogger.com/profile/08890886603298865263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDi92r3SgLwg-LL75fK-9dhvg50h_b3oKY_6gSMIHp7FjoHLswUT52FTty8TKeaS4-yTHdoNvzDvrB7h3Nx40CDX2P944GQ1FUUalBuPg9gJmEsHW98hHP-ffAZeC43A/s220/IMG_2395.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1889032152054434804.post-1500616571902223227</id><published>2011-02-24T12:35:00.000+05:30</published><updated>2011-02-24T12:35:43.848+05:30</updated><title type='text'>How to find the active element id using jquery?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;In many cases you wanted to know the element ID which is having the current focus. How will find out with out binding the focusin function.&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Here is the solution:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Declare the jquery extended function like&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;jQuery.extend(jQuery.expr[&#39;:&#39;], {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;focus: function (element) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return element == document.activeElement;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;});&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The above function returns the active element details .&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;You can access the active element by using the &quot;:&quot; method. For example&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;$(&quot;:&quot;).attr(&quot;id&quot;) . This statement will return the id of the element which is having the cursor position.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;same way you can find which input textbox is active now.($(&quot;input:text:focus&quot;).attr(&quot;id&quot;)).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;That&#39;s all you can able to find the active element id.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Enjoy!!!!!!!!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpvallab.blogspot.com/feeds/1500616571902223227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csharpvallab.blogspot.com/2011/02/how-to-find-active-element-id-using.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1889032152054434804/posts/default/1500616571902223227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1889032152054434804/posts/default/1500616571902223227'/><link rel='alternate' type='text/html' href='http://csharpvallab.blogspot.com/2011/02/how-to-find-active-element-id-using.html' title='How to find the active element id using jquery?'/><author><name>Vallab</name><uri>http://www.blogger.com/profile/08890886603298865263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDi92r3SgLwg-LL75fK-9dhvg50h_b3oKY_6gSMIHp7FjoHLswUT52FTty8TKeaS4-yTHdoNvzDvrB7h3Nx40CDX2P944GQ1FUUalBuPg9gJmEsHW98hHP-ffAZeC43A/s220/IMG_2395.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1889032152054434804.post-1319937266828077573</id><published>2011-02-08T10:59:00.000+05:30</published><updated>2011-02-08T10:59:38.204+05:30</updated><title type='text'>How to find out the value of the server side control using jquery?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;It happens many time that we do have the controls which are declared with runat=&quot;server&quot;. Accessing the value of those control is not so easy. For example&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&amp;lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;script src=&quot;jquery.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&amp;lt;/head&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&amp;lt;body&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;div&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;input runat=&quot;server&quot; id=&quot;TextBox1&quot; type=&quot;text&quot; /&amp;gt;&amp;lt;br /&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;asp:Button ID=&quot;TestButton&quot; runat=&quot;server&quot; Text=&quot;Button&quot; /&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;/div&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; &amp;lt;/form&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;We can access or set the value like this:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; $(function() {&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; $(&#39;#&amp;lt;%= &lt;b&gt;TestButton.ClientID&lt;/b&gt; %&amp;gt;&#39;).click(function(e) {&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; var testValue = &#39;Test Value&#39;;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; $(&#39;#&amp;lt;%= &lt;b&gt;TextBox1.ClientID&lt;/b&gt; %&amp;gt;&#39;).val(testValue);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; e.preventDefault();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; });&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt; });&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2f2f2f; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 12px; line-height: 17px; white-space: pre;&quot;&gt;Every control which is declared at server side will have different id assign by the framework.For accessing those control we need to use the clientID along with the control id.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpvallab.blogspot.com/feeds/1319937266828077573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://csharpvallab.blogspot.com/2011/02/how-to-find-out-value-of-server-side.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1889032152054434804/posts/default/1319937266828077573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1889032152054434804/posts/default/1319937266828077573'/><link rel='alternate' type='text/html' href='http://csharpvallab.blogspot.com/2011/02/how-to-find-out-value-of-server-side.html' title='How to find out the value of the server side control using jquery?'/><author><name>Vallab</name><uri>http://www.blogger.com/profile/08890886603298865263</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDi92r3SgLwg-LL75fK-9dhvg50h_b3oKY_6gSMIHp7FjoHLswUT52FTty8TKeaS4-yTHdoNvzDvrB7h3Nx40CDX2P944GQ1FUUalBuPg9gJmEsHW98hHP-ffAZeC43A/s220/IMG_2395.JPG'/></author><thr:total>0</thr:total></entry></feed>