Skip to content
TheChatArchiveThe Chat Archive
Perplexitypplx-70b-online· PerplexityHugging Face Arena Human Preference 55K

write me code for get data form html

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-2.1’s answer.
  1. User

    write me code for get data form html

  2. Perplexity Assistant

    To get data from an HTML form and display it on the browser, you can use JavaScript and jQuery. Here's a simple example of how to achieve this:

    1. Create an HTML form with input fields and a button to submit the data:
    <form id="myForm">
      <input type="text" id="inputName" placeholder="Enter your name">
      <input type="text" id="inputAge" placeholder="Enter your age">
      <button type="button" id="submitButton">Submit</button>
    </form>
    
    1. Use jQuery to get the values of the input fields when the "Submit" button is clicked:
    $(document).ready(function() {
      $('#submitButton').click(function() {
        var name = $('#inputName').val();
        var age = $('#inputAge').val();
    
        // Display the data
        $('#result').html('Name: ' + name + '<br>Age: ' + age);
      });
    });
    
    1. Create a div element with the ID "result" to display the data:
    <div id="result"></div>
    

    In this example, when the "Submit" button is clicked, the values of the input fields with IDs "inputName" and "inputAge" are retrieved using the .val() method, and the data is displayed in the "result" div.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.