Hey All,
I've got a piece of JavaScript that clears the data in a text box. The code works fine on a standalone page, but on the master page its not working.
On the default page my JavaScript is:
<script type="text/javascript">
function doClear(searchBox) {
if (searchBox.value == searchBox.defaultValue) {
searchBox.value = ""
}
}
</script>
And I this is what I'm doing to attach the OnClick property:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("onclick", "doClear(searchBox);");
}
The error is 'searchBox' is undefined!
Any help is greatly appreciated.
Matt