I'm using the Google autocomplete javascript code for address completion. It tracks the imput field getting the Id document.getElementById('addressField'). The problem I have is that the id of the input field looks like myForm:j_idt329:addressField. I need this in many different pages. So the id looks each time different but always contains the word addressField at the end. Is there another approach how to get the element? Maybe with RegEx? Here is the complete javascript:
function initialize() { var input = document.getElementById('addressField'); var options = { types: ['geocode'] }; var autocomplete = new google.maps.places.Autocomplete(input, options); } google.maps.event.addDomListener(window, 'load', initialize); Thanks in advance.