View Full Version : Text Field Value displayed in Checkbox
jm473
01-30-2006, 08:52 PM
I'm wondering if a script exists that will convert a text field value to a checked checkedbox in an html form? I don't have access to the database, and want to use a simple script on the form to take care of this.
Any help much appreciated.
jm
subhailc
01-30-2006, 09:56 PM
this is IE only but can be modified if you care
<html><script>
var el=document.getElementById;
function change(a,b){a.outerHTML=b;}
function inputtocb(a){change(a,"<input type=\"checkbox\" name=\""+a.name+"\" value=\""+a.value+"\" checked />");}
</script>
<body>
<input name="bob" id="bob" value="target" />
<button onclick="inputtocb(el('bob'))">click</button></html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.