Clear value in javascript

2 posts, 0 answers
  1. Dan
    Dan avatar
    13 posts
    Member since:
    Nov 2009

    Posted 01 Mar 2013 Link to this post


    I have an AutoCompleteBox and am trying to clear the client-side value using a javascript function.

    I have given an example below with a comment at where I am unsure of what property to use. When the button is clicked any user inputted text should be cleared and the EmptyMessage appears.

    function ClearBox()
        var box = $("#<%= ctrlBox.ClientID %>");
        //what do I put here to clear the value??
        //I tried box.text('') but it doesn't work
    <input type='button' onclick='ClearBox();' />
    <telerik:RadAutoCompleteBox ID="ctrlBox"
           Delimiter=" "
           EmptyMessage="Type here"
           OnClientRequesting="requesting" >
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Mar 2013 Link to this post


    Try the following javascript.
    function ClearBox() {
            var autoCompleteBox = $find("<%=ctrlBox.ClientID %>");
            var firstEntry = autoCompleteBox.get_entries().getEntry(0);
            if (firstEntry) {

Back to Top