<?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>Retoucher.jp &#187; Jquery</title>
	<atom:link href="http://retoucher.jp/archives/category/pc/jquery-pc/feed" rel="self" type="application/rss+xml" />
	<link>http://retoucher.jp</link>
	<description>主にPC関連の備忘録と映画の感想を書いています。</description>
	<lastBuildDate>Wed, 07 Mar 2012 07:01:37 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Jqueryとフォームの覚え書き</title>
		<link>http://retoucher.jp/archives/444</link>
		<comments>http://retoucher.jp/archives/444#comments</comments>
		<pubDate>Wed, 02 Mar 2011 04:42:52 +0000</pubDate>
		<dc:creator>taiyo</dc:creator>
				<category><![CDATA[Jquery]]></category>

		<guid isPermaLink="false">http://retoucher.jp/?p=444</guid>
		<description><![CDATA[最近のフォームはイロイロJqueryで作られていて面白いですね。 プラグインを使うのは簡単ですが、それだとJqueryの仕組みが理解できなくなったり、忘れたりするので、自分なりに紐解いてみようかなとおもいました。 Twitterにある文字制限のようなものを作りたい場合、setIntervalを使用して、フォーム内のTextareaの値を確認。 $(&#8220;form :textarea[name='XXXXX']&#8220;).val()； 予め決めた文字数から、下記のものを引いて、 $(&#8220;#sample&#8221;).text(&#8220;値&#8221;)； もし、文字数が超えたり、必要な情報が未入力だった場合に送信ボタンを押せなくするには,if文等を用いて、 $(&#8220;form :input[name='submit']&#8220;).attr(&#8216;disabled&#8217;,'disabled&#8217;); また、サーバーによってはmethod=&#8221;post&#8221;が使えないので、getで対応。 (※自分はさくらインターネットなので、ダメでした。) php側でのスクリプトの記述を気をつけなければいけない。 test = setInterval(function(){ 　　　　var val = $(&#8220;form :textarea[name='AAA']&#8220;).val(); 　　　　var max = 100; 　　　　var nowlength = max &#8211; val.length; 　　　　$(&#8220;#test&#8221;).text(nowlength); 　　　　if(nowlength < 0 &#124;&#124; nowlength == max){ 　　　　$("form :input[name='submit']").attr("disabled","disabled"); 　　　　}else{ 　　　　$("form :input[name='submit']").attr("disabled",""); 　　　　} }, 1000);]]></description>
			<content:encoded><![CDATA[<p>最近のフォームはイロイロJqueryで作られていて面白いですね。<br />
プラグインを使うのは簡単ですが、それだとJqueryの仕組みが理解できなくなったり、忘れたりするので、自分なりに紐解いてみようかなとおもいました。</p>
<p><span id="more-444"></span></p>
<p>Twitterにある文字制限のようなものを作りたい場合、<strong>setInterval</strong>を使用して、フォーム内のTextareaの値を確認。</p>
<div id="sample">$(&#8220;form :textarea[name='XXXXX']&#8220;).val()；</div>
<p>予め決めた文字数から、下記のものを引いて、</p>
<div id="sample">$(&#8220;#sample&#8221;).text(&#8220;値&#8221;)；</div>
<p>もし、文字数が超えたり、必要な情報が未入力だった場合に送信ボタンを押せなくするには,if文等を用いて、</p>
<div id="sample">$(&#8220;form :input[name='submit']&#8220;).attr(&#8216;disabled&#8217;,'disabled&#8217;);</div>
<p>また、サーバーによっては<strong>method=&#8221;post&#8221;が使えない</strong>ので、getで対応。<br />
(※自分はさくらインターネットなので、ダメでした。)<br />
php側でのスクリプトの記述を気をつけなければいけない。</p>
<div id="sample">
test = setInterval(function(){<br />
　　　　var val = $(&#8220;form :textarea[name='AAA']&#8220;).val();<br />
　　　　var max = 100;<br />
　　　　var nowlength = max &#8211; val.length;<br />
　　　　$(&#8220;#test&#8221;).text(nowlength);	</p>
<p>　　　　if(nowlength < 0 || nowlength == max){<br />
　　　　$("form :input[name='submit']").attr("disabled","disabled");<br />
　　　　}else{<br />
　　　　$("form :input[name='submit']").attr("disabled","");<br />
　　　　}<br />
}, 1000);
</div>
]]></content:encoded>
			<wfw:commentRss>http://retoucher.jp/archives/444/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>初心者なので・・・</title>
		<link>http://retoucher.jp/archives/206</link>
		<comments>http://retoucher.jp/archives/206#comments</comments>
		<pubDate>Thu, 18 Jun 2009 02:23:49 +0000</pubDate>
		<dc:creator>taiyo</dc:creator>
				<category><![CDATA[Jquery]]></category>

		<guid isPermaLink="false">http://retoucher.jp/?p=206</guid>
		<description><![CDATA[jqueryを最近イジってます。 通常文字と変数は「＋」で連結するのは分かっているんですが、jqueryのＣＳＳに変数を入れる際にイロイロやってみても、エラーで動かない・・・・ とりあえず自分が間違っていたのが以下。 css({&#8220;&#8216;backgroundImage&#8217;:&#8221; + Img + ? 正しいのはコレ・・・ css({&#8216;backgroundImage&#8217;: Img ? 何とか動くようになったのが、以下のサンプル。 $(&#8220;li&#8221;).each(function(i){ var Img = &#8216;url(&#8220;listbg&#8217; + i + &#8216;\.gif&#8221;)&#8217;; $(this).css({&#8216;backgroundImage&#8217;: Img ,&#8217;backgroundRepeat&#8217;:'no-repeat&#8217;,'backgroundPosition&#8217;:&#8217;0px 0px&#8217;}); }); リストに個別の背景を使ってアイコン化したかったんです。 とりあえず、うまくいったので、備忘録！！！]]></description>
			<content:encoded><![CDATA[<p>jqueryを最近イジってます。<br />
通常文字と変数は「＋」で連結するのは分かっているんですが、jqueryのＣＳＳに変数を入れる際にイロイロやってみても、エラーで動かない・・・・</p>
<p><span id="more-206"></span></p>
<p>とりあえず自分が間違っていたのが以下。</p>
<div id="sample">css({&#8220;&#8216;backgroundImage&#8217;:&#8221;  + Img + ? </div>
<p>正しいのはコレ・・・</p>
<div id="sample">css({&#8216;backgroundImage&#8217;: Img ?</div>
<p>何とか動くようになったのが、以下のサンプル。</p>
<div id="sample">
$(&#8220;li&#8221;).each(function(i){<br />
var Img = &#8216;url(&#8220;listbg&#8217; + i + &#8216;\.gif&#8221;)&#8217;;<br />
$(this).css({&#8216;backgroundImage&#8217;: Img ,&#8217;backgroundRepeat&#8217;:'no-repeat&#8217;,'backgroundPosition&#8217;:&#8217;0px 0px&#8217;});<br />
});
</div>
<p>リストに個別の背景を使ってアイコン化したかったんです。<br />
とりあえず、うまくいったので、備忘録！！！</p>
]]></content:encoded>
			<wfw:commentRss>http://retoucher.jp/archives/206/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

