jQuery attribute selector in traditional web

I need to select the Dom element using jquery attribute selector the attribute name is string  and the value will be from js local variable.
It works fine on browser console, If add that same code to Outsystems RunJavaScript action it throws this error

$('[data="' + temp.context.attributes[7].value + '"]')[1].checked = false;

Thanks,

 

jqueryselectorissue.png

Hi,

I see a wrong usage of single/double quotes right before/after the plus. So the correct format is:

$('[data='" + temp.context.attributes[7].value + "']')[1].checked = false;

This would solve the current error, but I'm not sure if the temp element will be found afterwards. Are you passing it into JS with a local variable?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.