Search code examples
htmlruby-on-railsutf-8slim-lang

Bullet Points (•) as Password Input Placeholder


I'm trying to get an input field to have a placeholder with bullet points in it.

= f.label "Password"
= f.password_field :password, autocomplete: "off", 
    placeholder: "eg. •"

This gives me the following html output:

<div class="field">
  <label for="user_Password">Password</label>
  <input value="password" autocomplete="off" placeholder="eg. &bull;" type="password" name="user[password]" id="user_password">
</div>

The input placeholder is actually displaying &bull; where I want it to show a bullet.

Any ideas on how I can get the placeholder to display the bullet instead?

I tried to reproduce the error on CodePen; however, it is working there: CodePen Example

I've also tried using another version of the encoding: &#8226; which produced the same output.

Note - I'm using Rails 4.2.0 with the Slim template language.


Solution

  • Try using raw:

    = f.label "Password"
    = f.password_field :password, autocomplete: "off", 
        placeholder: raw("&bull;")