hudsonsferreira hudsonsferreira - 5 months ago 58
jQuery Question

Jquery mask plugin working sometimes on rails 4

I'm trying to use mask on my form. So:
My application.js file:

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require select2
//= require masks


My masks.js file:

$(document).ready(function(){
$('#cep').mask('99999-999');
$('#phone').mask('(99) 99999-9999');
$('#second_phone').mask('(99) 99999-9999');
});


My view:

.col-lg-6
.form-group
= f.input :telefone, :input_html => { :class => 'form-control', |
:id => 'phone' }


The plugin reference https://github.com/igorescobar/jQuery-Mask-Plugin.

What is wrong?

Answer

I just removed //= require turbolinks from application.js and worked fine.

Comments