Reputation: 457
What is wrong with my code?
var form = $('#actor-form');
form.append('<input name ="actor-id" type="hidden" value="' + datum.id + '">');
form.append('<input name ="actor-email" type="hidden" value="' + datum.email + '">');
})
})( jQuery );
It keeps throwing errors, should it be???
var form = $('#actor-form');
form.append('<input name ="actor-id" type="hidden" value="' + datum.id + '">
<input name ="actor-email" type="hidden" value="' + datum.email + '">');
})
})( jQuery );
I'm not sure. Please help!
Upvotes: 0
Views: 97
Reputation: 26
If type is hidden then you can't test. i changed type as text to see if it is working or not. has to check your datum object also once for sure.
$(function(){
var form = $('#actor-form');
var datum = {};
datum.id = 1001;
datum.email = "[email protected]";
form.append('<input name="actor-id" type="text" value="' + datum.id + '">');
form.append('<input name="actor-email" type="text" value="' + datum.email + '">');
});
Upvotes: 1
Reputation: 5332
(function($) {
// here initialize datum variable
var form = $('#actor-form');
form.append('<input name ="actor-id" type="hidden" value="' + datum.id + '">');
form.append('<input name ="actor-email" type="hidden" value="' + datum.email + '">');
})( jQuery );
Upvotes: 0