Jump to content

Change Value of Input


Spunky

Recommended Posts

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 by Spunky
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...