Skip to content

Instantly share code, notes, and snippets.

@rashita
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rashita/61010c82aeb0bfa74040 to your computer and use it in GitHub Desktop.
Save rashita/61010c82aeb0bfa74040 to your computer and use it in GitHub Desktop.
備忘録代わりに
//jQueryの書き方
$(function(){
//ここに処理を書く
});
//実際例:メソッド
$(function(){
$("#maintext").focus(function(){
$("#side1 ,#side2").fadeOut('slow');
});
});
//id="maintext"の要素にフォーカスが当たったら、カッコの中の処理を実行する
//id="side1"とid="side2"の要素をフェードアウトさせる。時間はslowで。
//実際例:値の取得
$(function()){
var iText = $("#logtasklist").text() ;
var iVal = $("#logtasklist").val() ;
});
//上記のように書けば、要素から値を取得できる。一般の要素はtextかhtmlが使える。form系の部品はval(値)となる。
//実際例:値の設定
$(function()){
$("#logtasklist").text("私はテストテキストです。") ;
var hello = "hello world";
$("#logtasklist").val(hello) ;
});
//()の中に値を描き込めば、値の設定になる。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment