Help with "SyntaxError: Unexpected EOF" error

I’m using query’s ui dialog and i’m adding a form to the dialog box. If I use any spaces or returns between the tags I get the following error: SyntaxError: Unexpected EOF

If I move everything onto one line it fixes the problem, but it is obviously very difficult to read. Is there another way to handle this?

here is the script (it is working but difficult to read and make changes to)


$(document).ready(function() {
	var $dialog = $("<div></div>")
		.html("<form action='scripts/proc_registered_user.php' method='post' name='form' id='form' accept-charset='utf-8'><fieldset><input type='hidden' name='unreguser' value='%s' id='unreguser' /> <br /><h1>This is an unregistered user.</h1><p>....</p></fieldset><br /><p id='mail_submit'><input type='submit' value='Yes, Send an email' /></p></form>")
		.dialog({
			autoOpen: false,
			title: 'Basic Dialog'
		});

	$('#opener').click(function() {
		$dialog.dialog('open');
		// prevent the default action, e.g., following a link
		return false;
	});
});

</script>

Just remembered my form is being generated with dynamic content from the database. So instead how do I grab the form which is in a div with id=‘form’ and insert it into the .html() part of the dialog function?

never mind figured out the problem here it is if anyone else needs it:


$(document).ready(function() {
		var $dialog = $("<div></div>")
			.html($('#email_form').html())
			.dialog({
				autoOpen: false,
				title: 'Basic Dialog'
			});

		$('#opener').click(function() {
			$dialog.dialog('open');
			// prevent the default action, e.g., following a link
			return false;
		});
	});