jQuery throws an error when button is being disabled I'm very confused about jQuery acting strange after I run this chunk of code:
$('#importUsers').on('click', function() {
var data = {};
data.string = $('[name="manuelni"]').val();
if(data.string!=''){
$('#importUsers').prop('disabled', true);​
$('#importUsersFile').prop('disabled', true);​
$('[for="fileToUpload"]').prop('disabled', true);​
$.ajax({
url: 'import.php', // point to server-side PHP script
dataType: 'JSON',  // what to expect back from the PHP script, if anything
data: data,
type: 'post',
beforeSend: function(){
$('#opacity').addClass('overlay-div');
$('#pureMagic').addClass('magic-div');
$("#fileToUpload").removeAttr('type');
},
success: function(php_script_response){
// display response from the PHP script, if any
}
});
}
    });

It says 

Uncaught SyntaxError: Invalid or unexpected token

in this part:
$('#importUsers').prop('disabled', true);​
$('#importUsersFile').prop('disabled', true);​
$('[for="fileToUpload"]').prop('disabled', true);​


Immediately after page is being loaded. So I don't click on button with id "importUsers".
I tried this: 
$('#importUsers').attr('disabled', true);​
$('#importUsersFile').attr('disabled', true);​
$('[for="fileToUpload"]').attr('disabled', true);​

This:
$('#importUsers').attr('disabled', 'disabled');​
$('#importUsersFile').attr('disabled', 'disabled');​
$('[for="fileToUpload"]').attr('disabled', 'disabled');
​

And this:
$('#importUsers').prop('disabled', 'disabled');​
$('#importUsersFile').prop('disabled', 'disabled');​
$('[for="fileToUpload"]').prop('disabled', 'disabled');

All these selected elements are regular buttons that should not make problems when are attempted to be disabled. I'm using jQuery v1.12.0. Any suggestions?

Looks like you have unprintable characters in your code, delete last characters in lines shown on screenshot and you should be fine


The below code is working for me
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#importUsers').on('click', function() {
$('#importUsers').prop('disabled', true);
});
});
</script>

HTML
 <input type='button' id = 'importUsers' name='importUsers' Value='Import Users'>