I can't figure out how to get this phone number input mask and Save/Edit input feature to play nice together.
Basically I need the input field to be disabled unless Edit is selected, then it becomes enabled, then disabled again when Save is selected.
var phoneInputEdit = document.getElementById('phone-input-edit');
if (phoneInputEdit) {
new Formatter(phoneInputEdit, {
'pattern': '({{999}}) {{999}}-{{9999}}',
'persistent': true
});
And
$(document).ready(function() {
$('.has-feedback input[name="Edit"]').click(function() {
$(this).val(function(i,v) {
return v === 'Edit' ? 'Save' : 'Edit';
});
//$(this).parent().prev().prev().next('img').toggle();
$(this).parent().prev().prev().next('img').toggleClass('icon-inactive');
$(this).parent().prev().prev('input[required]').prop('readonly',function(i,r) {
return !r;
});
});
});
I tried wrapping the input mask in noConflict() but that didn't seem to work. If I get rid of all of the input mask code then of course the Save/Edit works which made me think it must be a library conflict. Maybe I did it wrong.