Spunky Posted January 22, 2015 Share Posted January 22, 2015 (edited) var contentString = '<div id="infoContent">'+ '<strong>'+address+','+price+','+'Mortgage: '+mortgage+' Taxes: '+taxes+' Year: '+year+'</strong>'+ '#<span id="number">'+house_number+'</span>'+ '</div>'+ '<a href="#edit"><span onClick="editDetails()">edit</span></span>'; house_number++ return contentString;} This code is returned to a function that creates a Info Window in a Google Map to appear when the user clicks on a marker on the map. The next set of code is what editDetails() does. function editDetails(){ var data_edit = "<div id="houseDetails">"; data_edit+= "<div id="details">"; data_edit+= "<h4>Details</h4>"; data_edit+= "Price:<input type="text" id="price" value="" class="boxsize">"; data_edit+= "Mortgage:<input type="text" id="mortgage" value="" class="boxsize">"; data_edit+= "</div>"; data_edit+= "</div>"; document.getElementById("data_edit").innerHTML = data_edit; document.getElementById("data_edit").style.display = "block"; document.getElementById("new_address").style.display = "hidden"; thishouse = document.getElementById("number").innerHTML; document.getElementById('price').value = "hi"; document.getElementById('mortgage').value = myhouses[thishouse].mortgage;} All those input textboxes appear and then I am attempting to change the value in the textboxes. The first one shows: document.getElementById('price').value = "hi"; Just as a test because I am otherwise not sure why it is not working. If I alert: myhouses[thishouse].mortgage The expected value does appear, so that is not an issue. The issue is, why does the value not change? Edited January 22, 2015 by Spunky Link to comment Share on other sites More sharing options...
justsomeguy Posted January 22, 2015 Share Posted January 22, 2015 There's probably an error message on the console. Although, why not just set the value in the HTML when you create the element? Link to comment Share on other sites More sharing options...
Spunky Posted January 23, 2015 Author Share Posted January 23, 2015 There's probably an error message on the console. Although, why not just set the value in the HTML when you create the element? Lol I do not know. Doh! But it worked so thanks. Oh and I forgot to mention that there was no error on the console. Usually I think of it cuz there is an error but this time there wasn't. It just, did nothing. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now