ruby on rails - Telephone mask not working with maskedinput -


i not getting mask show when typing number shows on demo. using gem 'maskedinput-rails'.

my code is:

<div class="form-group">   <label class="control-label col-sm-5" for="phone">phone number:</label>   <div class="col-sm-7">     <%= f.telephone_field :phone, class: 'form-control', value: number_to_phone(@appointment.phone, area_code: true) %>   </div>   <script>      jquery(function($){     $("#phone").mask("(999) 999-9999");     });   </script>  </div> 

as vee points out, problem selector. once have loaded page in browser, can check source see id of text field is. said, if did not change formbuilder configuration, should #model_attribute, in case #appointment_phone. so:

<script>    jquery(function($){     $("#appointment_phone").mask("(999) 999-9999");   }); </script>  

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -