jQuery を使用して括弧の間にテキストを配置する必要があります。検索などのアクションが発生すると、コンテンツが更新されます。
構造は次のとおりです。
<h2>Placeholder Text Placeholder Text Placeholder Text ()</h2>
jQuery を使用して括弧の間にテキストを配置する必要があります。検索などのアクションが発生すると、コンテンツが更新されます。
構造は次のとおりです。
<h2>Placeholder Text Placeholder Text Placeholder Text ()</h2>
indexOfメソッドを使用できます。
text = $("h2").text();
pos1 = text.indexOf("(");
pos2 = text.indexOf(")");
newText = text.substring(0, pos1 + 1) + myText + text.substring(pos2);
上記は、テキスト内に括弧のペアが 1 つだけあることを前提としています。