title: How can I programmatically select a listview item?
body: <p>How can I programmatically select a listview item?</p>
  
  <p>I have the following listview:</p>
  
  <pre><code>listview =
      select [ Html.Events.on "change" (Json.Decode.map InputContentType Html.Events.targetValue) ]
          [ option [ value "instructions" ] [ text "Content Type" ]
          , option [ value "Article" ] [ text "Article" ]
          , option [ value "Video" ] [ text "Video" ]
          , option [ value "Answer" ] [ text "Answer" ]
          , option [ value "Podcast" ] [ text "Podcast" ]
          ]
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I incorporated the posted answer below and updated the solution as follows:</p>
  
  <pre><code>( isArticle, isVideo, isAnswer, isPodcast ) =
              if hasText "youtube.com" then
                  ( False, True, False, False )
              else if hasText "vimeo.com" then
                  ( False, True, False, False )
              else if hasText "wordpress.com" then
                  ( True, False, False, False )
              else if hasText "medium.com" then
                  ( True, False, False, False )
              else if hasText "stackoverflow.com" then
                  ( False, False, True, False )
              else
                  ( False, False, False, False )
  
          listview =
              select [ Html.Events.on "change" (Json.Decode.map InputContentType Html.Events.targetValue) ]
                  [ option [ value "instructions" ] [ text "Content Type" ]
                  , option [ value "Article", selected isArticle ] [ text "Article" ]
                  , option [ value "Video", selected isVideo ] [ text "Video" ]
                  , option [ value "Answer", selected isAnswer ] [ text "Answer" ]
                  , option [ value "Podcast", selected isPodcast ] [ text "Podcast" ]
                  ]
  </code></pre>