I have a few select elements on my page and i want to remove a part of the name.
Their name look something like this:
ctl02$fieldname
The part that i want to remove is: ctl02$. So that it leaves me with fieldname only.
That part that i want to remove always starts with ctl then a two digit number ending with a $.
I tried it with the following code, but that didn't do the trick:
$(".elements select").each(function() {
this.setAttribute("name", this.getAttribute("name").replace(/ctl([0-9]+)\$$/, ""));
});
Anyone any idea how i can do this?
Here's a demo: http://tinkerbin.com/Klvx5qQF