LoginSignup
1
1

More than 1 year has passed since last update.

【jquery】val()の使い方 ※value値を取得するだけ

Last updated at Posted at 2021-09-02

jQuery

<!DOCTYPE html>
<html lang="ja">
<head>
   <meta charset="UTF-8">
   <div class="target">
     <input  value="1">
     <input name="shain_name"  value="ABCDEFG">
     <input  value="2">
     <input  value="8888" class="pKisu" >
   </div>
    <script src="jquery-3.6.0.min.js"></script>
    <script>
      $(function(){
//////////////↓ここの部分///////////////////////////
        result_01 = $('.target').find('input[name=shain_name]').val();
        result_02 = $('.pKisu').val();
//////////////↑ここの部分///////////////////////////
        console.log(result_01);
        console.log(result_02);
      });
    </script>

出力結果

ABCDEFG
8888
1
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
1
1