I want to add extra expressions to some JS code, but taking care of the correct element ID (in the example below, the ID is scatter
).
document.getElementById("scatter").height="400"; -->
document.getElementById("scatter").height="400"; document.getElementById("scatter").style="visibility: visible";
My attempt so far has been:
M-x replace-regexp RET
Id("\(\w+\)").height="400"; RET
Id("\0").height="400"; document.getElementById("\0").style="visibility: visible";
Where \(\w+\)
grabs the element ID and \0
references it on the replacement string.
Unfortunately replace-regexp
is complaining that I'm using \
incorrectly.
Could anyone point out what I'm doing wrong?
\1
instead of\0
.