mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-04 23:45:04 -04:00
Keep save button disabled if changed username invalid
- Disabled till username not changed - On change, if username is empty, then disabled - On change, if username is changed back to previous, then disabled - Else allow saving
This commit is contained in:
parent
52971ad371
commit
7935d07bb3
3 changed files with 12 additions and 1 deletions
|
@ -34,6 +34,15 @@ $(function(){
|
|||
emitMessage(socket);
|
||||
});
|
||||
|
||||
// Keep buttons disabled unless changed or not empty
|
||||
$('#username').on('keyup',function() {
|
||||
if ($('#username').val() !== '' && $('#username').val() !== current_username) {
|
||||
$('#update-username').removeAttr('disabled');
|
||||
} else {
|
||||
$('#update-username').attr('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
// Update username
|
||||
$('#update-username').on('click', function() {
|
||||
var username = $('#username').val();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue