<form id="createdirForm"><input type="text" name="" id="createdir"/><form>
newdirname = prompt('Please input the directory name:', '');
if (!newdirname) return;
$('createdir').newdirname.value = newdirname;
The reason why it's not working is because you're not calling the selector in your jQuery properly.
You might want to take a look at the jQuery Selector Tutorial.
Now to fix your problem, since you want to get the input and the form by the
id attribute, just like in CSS, you need to use the
hashtag (#) symbol.
So you would do:
Here's a working example: https://jsfiddle.net/vm4ah1L3/1/
Just a side note, you might want to add a name to your html input otherwise when you submit it to your PHP, you won't be able to retrieve the value since the name attribute is empty.
<input type="text" name="dirName" id="createdir">
And in your case, since you're declaring the variable
newdirname and assign it right after, you could simply do the assignation in one line:
var newdirname = prompt("Please input a directory name: ");