Javascrip Replace not Replacing

B

Brad

I have the following function:

function updaterec(i, callid){
var theExp = new RegExp(callid, 'gi');
var x = document.getElementById(i.id.replace(RegExp,'tb_linechage'));
x.value = 'Y';}

I call this function with:
updaterec(this, 'tb_assigneddt'); // this =
dl_inspectionlist__ctl1_tb_assigneddt

I want to update dl_inspectionlist__ctl1_tb_linechage but
dl_inspectionlist__ctl1_tb_assigneddt keeps updating itself instead.
What am I missing?

Any help is greatly appreciated.

Thanks,
Brad
 
L

Lasse Reichstein Nielsen

Brad said:
var theExp = new RegExp(callid, 'gi'); ^^^^^^
var x = document.getElementById(i.id.replace(RegExp,'tb_linechage'));
^^^^^^
The "RegExp" should probably be "theExp".

/L
 
B

Brad

Um, Yeah, that would be it...

You know, this is one of those days you wish you could go back to bed
and start all over.

Thanks for pointing out the obvious.

~Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top