My question is quite simple but I cannot find the truth
It is possible to use regex in Javascript onclick event (HTML)?
for example is it possible to show div with different id but a same tag using regex :
div s:
<div class='zone' id='{{site.City}}'>
<div class='zone' id='{{site.City}}{{immo.CodeImmo}}'>
<div class='zone' id='{{site.City}}{{sth else}}'>
javascript regex :
onclick='$("#/^{{site.City}}./").show();'
I am worried about the regex syntax in the Javascript onclick event.
Is it possible? and how is it possible to do it?
This question is for my personal knowledge. Thanks
EDIT :
ok I know now I can use:
onclick=`$('div[id*="{{site.City}}"]').show();`
but how can I do if {{site.City}} is a chain variable?
What is the syntax for a loop in onclick even with a django dictionnary variable?
It's not the topic. It is still for my knowledge. thx
jQuery selector
, ie$('.zone')
. – Jan Jun 28 at 7:33data
– Jan Jun 28 at 7:47