jQuery not selecting id containing “<” angular bracket?
问题 I am not able to select checkbox which has id="check stage<lead>" in jQuery Selector. HTML: <input id="check stage<lead>" type="checkbox" title="Select/Unselect Column" name="chk-stage-column-select" value="" onchange=""> Javascript: // escape jquery selectors function jQueryEscape(str) { if (str) return str.replace(/([ #;?%&,.+*<>~\':"!^$[\]()=>|\/@])/g, '\\$1'); return str; } var StageName = "<lead>"; $("[id='check stage" + jQueryEscape(StageName) + "']").prop("checked", true); Equivalent