I am trying to select an html element with javascript without! JQuery ...
for example my html:
<div id="my1231">
</div>
and I want to select any first div with id started with my, and I will try:
var regex = /my(.*)/;
var templateCode = document.match(regex)
alert(templateCode);
but nothing happened, what am I doing wrong? how to select a div with regex, where the first part of id is static and the second is random?
source
share