function createSearchTool(){ //add the toolbar section that holds the search tool var wrapperDiv = dojo.create('div',{ id:'searchWrapper' },dojo.byId('webmap-toolbar-right')); dojo.addClass('searchWrapper','searchwrapper'); var searchInput = dojo.create('input',{ id:'searchField', type:'text', placeholder: i18n.tools.search.title, onkeydown: function(e) { if(e.keyCode === 13){ findLocation(); } } },wrapperDiv); dojo.addClass(dojo.byId('searchField'),'searchbox'); dojo.create('input',{ type:'image', id:'blankImage', src:'images/blank.gif' },wrapperDiv); dojo.connect(dojo.byId('blankImage'),'onclick',function(){ findLocation(); }); dojo.addClass(dojo.byId('blankImage'),'searchbutton'); //add placeholder for browsers that don't support (IE) if (!supportsPlaceholder()) { var search = dojo.byId("searchField"); var text_content = i18n.tools.search.title; search.style.color = "gray"; search.value = text_content; search.onfocus = function () { if (this.style.color === "gray") { this.value = ""; this.style.color = "black"; } }; search.onblur = function () { if (this.value === "") { this.style.color = "gray"; this.value = text_content; } }; } //if there were url params zoom to them if(urlObject.query && urlObject.query.address){ dojo.byId('searchField').value = urlObject.query.address; findLocation(); } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.