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.
変数に改行があると jQuery が機能しない理由:
これは機能します:
var text = "This is my text and it works fine";
これはしません:
var text = "this is my text and it does not work";
これを回避する方法はありますか?データベースからテキストを含む変数を作成しようとしていますが、改行やタグが含まれている可能性があります...
Try Below
var text = "this is my text"; text += " and it does not work";
OR
var text = "this is my text" + " and it does not work";
var text = "this is my text \ and it DOES work now";
次の方法は正しいです -
var text = "this is my text " + "and it DOES work now! ";
このデモをチェック