Reputation: 304
I'm trying out a javascript in my rails with jQuery setup, but I'm getting an error: "Uncaught SyntaxError: Unexpected string"
$(document).ready({
$('#pitch_name').on('change',function() {
$('#edit_pitch_name').remove();
});
});
Any ideas on what I'm missing here?
Upvotes: 0
Views: 353
Reputation: 924
You are missing function
$(document).ready(function(){
$('#pitch_name').on('change',function() {
$('#edit_pitch_name').remove();
});
});
Upvotes: 1
Reputation: 4674
You have written a wrong syntax of document.ready
missing of function()
, you should use below code::
$( document ).ready(function() {
// Your code
});
Official documentation:: Link
Upvotes: 2