I have an ASP.NET user control that contains a textbox which has an AJAX CalendarExtender control which allows users to select a date which then populates the textbox.
I can clear the textbox value using a submit button and setting the value to null in the code behind, but I need to set the value to “” in the textbox using Javascript.
I have tried the following javascript but it didn’t work:
function ClearTextBox()
{
document.getElementsByName('TextBox1').Value = "";
}
What javascript should I use?
Value=>value. JavaScript is case sensitive…getElementsByNamereturns an array of elements so select the first element with[0]or select the element by id: