<?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>S i X h E a D { ? } &#187; textarea</title>
	<atom:link href="http://sixhead.com/tag/textarea/feed/" rel="self" type="application/rss+xml" />
	<link>http://sixhead.com</link>
	<description>เมื่อความรู้มีไว้แบ่งปัน</description>
	<lastBuildDate>Sun, 25 Dec 2011 04:15:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>จำกัดจำนวนตัวอักษรใน textarea</title>
		<link>http://sixhead.com/2009/06/30/limit-textarea-maxlength/</link>
		<comments>http://sixhead.com/2009/06/30/limit-textarea-maxlength/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 16:01:01 +0000</pubDate>
		<dc:creator>Pipo</dc:creator>
				<category><![CDATA[Developer]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[length]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://sixhead.com/?p=455</guid>
		<description><![CDATA[บางครั้งเราต้องการจำกัดจำนวนตัวอักษรใน textarea ปรากฏว่ามันไม่ง่ายเหมือน text box ที่เราสามารถใส่ attribute maxlength เข้าไปจำกัดตัวอักษรได้ตรงๆ จึงต้องใช้ jquery เข้ามาช่วยดังตัวอย่าง &#160; &#60;script src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js&#34;&#62;&#60;/script&#62; &#60;script&#62; $(document).ready(function(){ $('#Wish').keyup(function(){ var max = parseInt($(this).attr('maxlength')); if($(this).val().length &#62; max){ $(this).val($(this).val().substr(0, $(this).attr('maxlength'))); } $('#WishMax').html('เหลืออีก ' + (max - $(this).val().length) + ' ตัวอักษร'); }); }); &#60;/script&#62; &#160; &#60;textarea name=&#34;Wish&#34; id=&#34;Wish&#34; maxlength=&#34;10&#34;&#62;&#60;/textarea&#62; &#60;div id=&#34;WishMax&#34;&#62;&#60;/div&#62; &#160;]]></description>
			<content:encoded><![CDATA[<p>บางครั้งเราต้องการจำกัดจำนวนตัวอักษรใน textarea ปรากฏว่ามันไม่ง่ายเหมือน text box ที่เราสามารถใส่ attribute maxlength เข้าไปจำกัดตัวอักษรได้ตรงๆ จึงต้องใช้ jquery เข้ามาช่วยดังตัวอย่าง<br />
<span id="more-455"></span></p>
<pre class="html4strict">&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script&gt;</span></a></span>
$(document).ready(function(){
	$('#Wish').keyup(function(){
		var max = parseInt($(this).attr('maxlength'));
		if($(this).val().length &gt; max){
			$(this).val($(this).val().substr(0, $(this).attr('maxlength')));
		}
		$('#WishMax').html('เหลืออีก ' + (max - $(this).val().length) + ' ตัวอักษร');
	});
});
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/textarea.html"><span style="color: #000000; font-weight: bold;">&lt;textarea</span></a> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Wish&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;Wish&quot;</span> <span style="color: #000066;">maxlength</span>=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/textarea&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;WishMax&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
&nbsp;</pre>
<p><map name='google_ad_map_455_f21c57aff87a446f'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/455?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_455_f21c57aff87a446f' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=455&amp;url= http%3A%2F%2Fsixhead.com%2F2009%2F06%2F30%2Flimit-textarea-maxlength%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://sixhead.com/2009/06/30/limit-textarea-maxlength/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

