0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jqualy よく使うやつ

Posted at

 .clone()

<button>Clone Me!</button>

jq
$("button").click(function(){
  $(this).clone(true).insertAfter(this);
});

 .find()

全てのp要素からfindを用いてspan要素を捜し、色を赤くします。これは$(“p span”)と同じ意味である。

<p><span>Hello</span>, how are you?</p>

<p>Me? I'm <span>good</span>.</p>
$("p").find("span").css('color','red');

 .uniqueId()

配列中から重複している値を除去し、ユニークになったものを返します。

 .val()

全ての要素のvalue属性を返す。

 .replace()

 .split()

.split()

 .pop()

.pop()

 .filter()

.filter()

 .append()

.append()

 .hide()

.hide()

 .show()

.show()

 .on() off

on発動  off解除

$('button').on('click', function() {
  alert('クリックされました');
});

$('button').click(function() {
  alert('クリックされました');
});

$('img').on({
  'mouseenter': function() {
    // マウスオーバー時の処理
  },
  'mouseleave': function() {
    // マウスアウト時の処理
  }
});

記事
http://js.studio-kingdom.com/jquery/events/off

 .parents()

.parents()

 .each()

.each()

 .change()

.change()

 .iCheck()

.iCheck()

 .css()

.css()

 .positon()

.positon()

 .width()

.width()

 .data()

カスタムデータ

値を適切な型にパースしてくれる

参照
JavaScriptで実際に必要な情報を取り出すためにデータをパースするのが難しくなる
https://www.webprofessional.jp/how-why-use-html5-custom-data-attributes/

データ属性得られる

<body>
<p data-name="taro" data-age="30" data-tel="080-1234-5678">私は太郎です</p>
 
<script>
    var result = $('p').data();
 
    console.log( result );
</script>
</body>

結果

{tel: "080-1234-5678", age: 30, name: "taro"}

 .addClass()

.addClass()

 .clear_up_form()

.clear_up_form()

 .not()

.not()

 .removeClass()

 .clear_up_form()

 .colorpicker()

 .bootstrapToggle()

 .text()

 .attr()

 .closest()

 .get()

 .prop()

 .modal()

 .sortable()

 .disableSelection()

 e.preventDefault()

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?