Why doesn't the input value attribute change?

Well, I have this code:

<input id="CI.SiteName" type="text" value="" name="@@CI.SiteName" disabled="">

and then I make some kind of event that would trigger this function:

chooseSite = function () {
    var url = "/main/Ajax/GetSiteDetail?" +
        "&cid=" + escape(idSite);

    var ajx = sendAJAX(url, true);

    ajx.onreadystatechange = function () {
        if (ajx.readyState == 4) {
            var result = ajx.responseText;      
            result = "TOP";
            document.getElementById("CI.SiteName").value = result;
        }   
    }
}

in the browser it changed to "TOP", but when I check the item with firebug, the VALUE INPUT attribute is still "" not changed.

+5
source share
1 answer

The attribute is valuenot synchronized with the actual value; what for property value.

This is not a problem because you will never use it .getAttribute('value'), but use the property .valueto access the current value.

+11
source

All Articles