Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
同じテキストで始まる2つの値をチェックする方法をjqueryします。
私のコードは
$a = "Hello john"; $b = "Hello peter";
$a == $b --> 偽
このように、文字列を開始する変数を見つける方法。
var $a = "Hello john"; var $b = "Hello peter"; if($a.split(" ")[0] == $b.split(" ")[0]) { alert('first word matched') }
注: これは最初の単語のみを比較します。文字列全体ではありません。