I have an input field which is created after looping through a data structure and creating html on the go. It looks like this
<input data-role="tagsinput" type="text" name="sales.sales_channel,no_tx" class="form-control" style="font-size:20px;">
Now I want to target the element by name. So this is what I do
$(`[name=${obj.table}.${key},${value.islow}]`)
This creates the identifier like below
[name=sales.sales_channel,no_tx]
But I get this error
Error: Syntax error, unrecognized expression: [name=sales.sales_channel,no_tx]
So I figured that jquery doesn't understand special characters and those special characters has to be escaped as suggested here https://stackoverflow.com/a/605835/5550284
So I did something like this
$(`[name=${obj.table}\\.${key}\\,${value.islow}]`)
But this doesn't work either. So how do I target the element by name containing special characters?