Avatar of KeithMcElroy
KeithMcElroy
 asked on

set name attribute failing

The attached code in a web page is not updating the name attribute.
The old name appears in the alert of outerHTML.
I tried removeAttribute then reassigning and NO name attribute shows.

What am i missing?
function addsplititem(id,idx,tbod,tab)
{

	var tab = GetElement("tblsplit_" + idx)

	var tbod = tab.tBodies[1]

	
	var trow = tbod.rows[tbod.rows.length - 1]

	var clonerow = trow.cloneNode(true);	
	var newtrow= tbod.appendChild(clonerow)
	
	newtrow.setAttribute("subidx", Number(newtrow.getAttribute("subidx")) + 1)
	var tds = newtrow.childNodes 
	for(t=0;t<tds.length;t++)
	{
		var sds = tds[t].childNodes
		for(s=0;s<sds.length;s++)
		{
			if(sds[s].nodeName == "INPUT")
			{
				if(sds[s].getAttribute("autoinc") == "b")
				{

					var arrpieces = sds[s].id.split("_")
					var loc0 = arrpieces[0]
					var loc1 = arrpieces[1]
					var loc2 = arrpieces[2]
					var loc3 = arrpieces[3]
					var loc4 = (Number(arrpieces[4]) + 1).toString()
					locid = loc0 + "_" + loc1 + "_" + loc2 + "_" + loc3 + "_" + loc4
					sds[s].id = locid
					sds[s].removeAttribute("name")
					sds[s].setAttribute("name",  locid)
				alert(sds[s].outerHTML)
				}
			}
		}
		
	}
	//alert(newtrow.outerHTML)
	
}

Open in new window

VB ScriptJavaScriptHTML

Avatar of undefined
Last Comment
KeithMcElroy

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
vr6r

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
KeithMcElroy

ASKER
yes, IE.  Need a work around.
Any hope of that?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck