Change Search Widget Text in CSS?

3668
14
Jump to solution
10-26-2018 09:43 AM
JaredPilbeam2
MVP Regular Contributor

How can I change "Find address or place" to "search" in the CSS? Can I override Esri's main.css file? 

I put in "content: 'search;'" here. There was no change.

Here's where it seems to be in one of my CSS files.

@media (max-width: 480px)
.esri-input.esri-search__input {
    visibility: visible;
    font-size: 12px;
    margin-right: 0px;
}

I tried this but there was no change:

content: "search" !important;
0 Kudos
14 Replies
RobertScheitlin__GISP
MVP Emeritus

Jared,

   Here is what I have tested and works for your scenario:

        //search widget
        var searchWidget = new Search({
          view: view,
          container: "searchDiv"
        });

        searchWidget.watch('activeSource', function(evt){
          evt.placeholder = "blah blah";
        });
0 Kudos
CarsonPruitt1
New Contributor

You don't have anything missing -- you have too much. 

"dojo/i18n!esri/nls/jsapi"

Needs to be removed. This is 3.x and you seem to be using 4.x based on the code you posted.

    require([
        "esri/Map",
        "esri/views/MapView",
        "esri/layers/FeatureLayer",
        "esri/layers/GraphicsLayer",
        "esri/widgets/Search",
        "esri/widgets/Home",
        "esri/widgets/Legend",
        "esri/widgets/Expand",
        "dojo/domReady!"
      ],
      function (
        Map, MapView, FeatureLayer, GraphicsLayer, Search, Home, Legend, Expand
      )
RobertScheitlin__GISP
MVP Emeritus

Carson,

   Actually the allPlaceholder property does not work in his case as he is not specifying any sources.

0 Kudos
JaredPilbeam2
MVP Regular Contributor

Thank you both. Right, i'm working with 4.9. I had ArcGIS API for JavaScript 4.9 as a tag, not in the title, which might have been a better idea. 

Anyway, I took out the 

"dojo/i18n!esri/nls/jsapi"

and also removed the allPlaceholder element. That wasn't it. 


@Robert,

How do you explain what you did there? Did you create an event based on the searchWidget?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jared,


  In the code I am watching for the active source to be set and then set the place holder. 4.x does not really uses events much instead you watch properties.