Started by Dixon MurrayNov 5, 2021

Open
Submit form using JQuery won't append to list

0 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 0 VIEWES SHARE

I want on the way to append to a listing (it's a leaderboard, but it's now not relevant) by way of filing through a shape and appending to an ordered listing using jquery. Once I press put up nothing occurs other than the button being pressed. Wherein am I going wrong?

<main>
  <ol class="playerList">
    <li>Profit - 12,565</li>
    <li>carpe - 11,423</li>
    <li>Fate  -  11,003</li>
    <li>Fleta  -  10,931</li>
    <li>Fury  -  10,704</li>
    <li>Gesture  -  10,601</li>
    <li>Choihyobin  -  10,012</li>
    <li>MekO  -  9,879</li>
    <li>Birdring  -  9,850</li>
    <li>Mano  -  9,766</li>
  </ol>
</main>
<footer>
    <form id="submissionForm">
      <label id="nameLabel" for="pName"><u>Player name:</u></label>
      <input id="pName" type="text" placeholder="Enter player name...">
      <label for="pElims"><u>Elimination Count:</u></label>
      <input id="pElims" type="text" placeholder="Enter elimination count...">
      <input id="submitBtn" type="submit">
    </form>
</footer>

JQuery:-

$(document).ready(function() {
$("#submissionForm").on('submit', function(event){
    event.preventDefault();
    error = false;
    $(".error").hide();
    var playerName = $("#pName").var();
    var elimCount = $("#pElim").var();
    var newItem = (playerName + "  -  "+ elimCount);
    $('.playerList').append('<li>'+ newItem + '</li>');
    return false;
   });
});

0 Replies

You must be Logged in to reply
Trending Categories
15
Software39
DevOps45
Frontend Development24
Backend Development18
Server Administration17
Linux Administration24
Data Center24
Sentry24
Terraform21
Ansible29
Docker28
Penetration Testing14
Kubernetes16
NGINX19
JenkinsX17
Techiio

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

facebooklinkdeintwitter

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Copyright techiio.com @2020 Kolkata, India
made with by Abhishek & Priyanka Jalan
Copyright techiio.com @2020
made with by Abhishek & Priyanka Jalan