Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- you'll use a unique ID to reference each field in the JS -->
<label>Name:</label> <input type="text" id="name"><br>
<textarea rows="4" cols="50" id="question" placeholder="Type your comment here and click 'send'!"></textarea>
<button id="send">Send</button>
              
            
!

CSS

              
                
              
            
!

JS

              
                // this code executes when the 'send' button is clicked
document.getElementById('send').onclick = function() {
    var request = new XMLHttpRequest();
    // change the webhook URL below (Discord channel settings > integration)
    request.open("POST", "WEBHOOK_URL_HERE");
    request.setRequestHeader('Content-type', 'application/json');
    // the below variables combine a label (text) + the textarea value + a newline (\n)
    // add up to 2,000 characters (Discord's character limit)
    var name = "Name: " + document.getElementById("name").value + "\n";
    var question = "Question: " + document.getElementById("question").value;
  
    // you have to combine both into one single variable before you can pass it to discord
    var date = new Date();
    var f_date = date.toLocaleDateString("en-US");
    var username = f_date;
    var msg = name + question;
    // play with it a bit until you get a feel for how you want the incoming messages to look!
  
    var params = {
      // you can set the username to anything you want
        username: username,
        content: msg,
    }
    request.send(JSON.stringify(params));

    // below gives your user some helpful feedback letting them know their message has been sent
    alert('Test!');
    // below clears the form fields after submission
    document.getElementById("question").value = '';
}
              
            
!
999px

Console