use prop instead of attr to disable elements

master
Daniel Berteaud 9 years ago
parent ef7b3967b2
commit d2fb92a046
  1. 18
      public/js/vroom.js

@ -215,9 +215,9 @@ function utc2Local(date) {
// Temporarily suspend a button, prevent overloading the backend // Temporarily suspend a button, prevent overloading the backend
// if someone start clicking quickly // if someone start clicking quickly
function suspendButton(el){ function suspendButton(el){
$(el).attr('disabled', true); $(el).prop('disabled', true);
setTimeout(function(){ setTimeout(function(){
$(el).attr('disabled', false); $(el).prop('disabled', false);
}, 1000); }, 1000);
} }
@ -1917,13 +1917,13 @@ function initVroom(room) {
$('#displayName').parent().removeClass('has-error'); $('#displayName').parent().removeClass('has-error');
} }
// Enable chat input when you set your disaplay name // Enable chat input when you set your disaplay name
if (name !== '' && $('#chatBox').attr('disabled')){ if (name !== '' && $('#chatBox').prop('disabled')){
$('#chatBox').removeAttr('disabled').removeAttr('placeholder'); $('#chatBox').prop('disabled', false).removeAttr('placeholder');
peers.local.hasName = true; peers.local.hasName = true;
} }
// And disable it again if you remove your display name // And disable it again if you remove your display name
else if (name === ''){ else if (name === ''){
$('#chatBox').attr('disabled', true).attr('placeholder', localize('SET_YOUR_NAME_TO_CHAT')); $('#chatBox').prop('disabled', true).attr('placeholder', localize('SET_YOUR_NAME_TO_CHAT'));
peers.local.hasName = false; peers.local.hasName = false;
} }
peers.local.displayName = name; peers.local.displayName = name;
@ -2004,7 +2004,7 @@ function initVroom(room) {
// Disable suspend webcam button if no webcam // Disable suspend webcam button if no webcam
if (!video){ if (!video){
$('.btn-suspend-cam').addClass('disabled').attr('disabled', true); $('.btn-suspend-cam').prop('disabled', true);
} }
// Suspend the webcam // Suspend the webcam
@ -2024,10 +2024,10 @@ function initVroom(room) {
// Handle auth to become room owner // Handle auth to become room owner
$('#ownerAuthPass').on('input', function() { $('#ownerAuthPass').on('input', function() {
if ($('#ownerAuthPass').val() === ''){ if ($('#ownerAuthPass').val() === ''){
$('#ownerAuthButton').attr('disabled', 'disabled'); $('#ownerAuthButton').prop('disabled', true);
} }
else{ else{
$('#ownerAuthButton').removeAttr('disabled'); $('#ownerAuthButton').prop('disabled', false);
} }
}); });
$('#ownerAuthForm').submit(function(event) { $('#ownerAuthForm').submit(function(event) {
@ -2049,7 +2049,7 @@ function initVroom(room) {
} }
else{ else{
$.notify(localize('WRONG_PASSWORD'), 'error'); $.notify(localize('WRONG_PASSWORD'), 'error');
$('#ownerAuthButton').attr('disabled', 'disabled'); $('#ownerAuthButton').prop('disabled', true);
} }
} }
); );

Loading…
Cancel
Save