0
0

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.

jQueryで取得した値をparseInt関数でInt型にする。

Last updated at Posted at 2018-06-29

jQueryで受け取った値がInt型じゃなかった!

$("input_data").click(function() {
    // parseIntで選択中の要素の値をInt型に変換する。
    var n = parseInt(this);

    //int型にしてから処理をする↓↓
    if (n > 5) {
        console.log("5より大きいっす!!");
    } else {
        console.log("5より小さいっす!!");
    }
});
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?