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" ); } ```