From f5304701862028efead18f64593179ca6c098a95 Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Mon, 12 Mar 2018 09:42:54 +0000 Subject: [PATCH] Added '~' to escaped id characters, and simplified regex --- ...element-by-an-id-that-has-characters-used-in-css-notation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/page/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation.md b/page/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation.md index 4551f7df..5286c659 100644 --- a/page/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation.md +++ b/page/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation.md @@ -25,7 +25,7 @@ The following function takes care of escaping these characters and places a "#" ``` function jq( myid ) { - return "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" ); + return "#" + myid.replace( /[:.[\],=@~])/g, "\\$1" ); } ```