![](/img/trans.png)
[英]My javascript output does not match the expected output. I don't know where I went wrong
[英]I want to add a field card to the to do table I created with .Net, but I don't know exactly where I went wrong
<h5 class="card-title">Upcoming</h5> <h6 class="card-subtitle text-muted">Upcoming Task</h6> <.--Table title.--> </div> <.--Card body.--> <div class="card-body p-3"> <div id="tasks-upcoming"> <.--Card Head.--> <div class="card mb-3 bg-light cursor-grab border drag-1" id="1"> <div class="card-body p-3"> <!--Check Box--> <div class="float-end mr-n2"> <label class="form-check"> <input type="checkbox" class="form-check-input" aria-label="completed" checked=""> </label> </div> <!--Check Box--> <!--Work title--> <p id="worktitle">Mobile Application</p> <!--Work title--> <!--Avatar--> <div class="float-end mt-n1"> <img id="userName" src="../images/DefaultUser-50.png" width="32" height="32" class="rounded-circle" alt="Avatar"> </div> <!--Avatar--> <a id="workShow" class="ist-group-item active waves-effect btn-primary btn-sm" data-toggle="modal" data-target="#ModalLong">Show</a> </div> </div> </div>
//Add to-do card function. $(document).ready(function () { classnames(); //call dragula dragula([ document.getElementById('tasks-upcoming'), document.getElementById('tasks-progress'), document.getElementById('tasks-completed'), document.getElementById('skill') ]).on('drop', function (el) { //change classes depending on column. classnames(); }); //static adding of values $(".submit").click(function () { var getvalue1 = document.getElementById("taskName"), //task titile. getvalue2 = document.getElementById("informationText"), //task information. getvalue3 = document.getElementById("skill") //personal. getvalue4 = document.getElementById("textBody"), //to-do text modal. a = getvalue1.value, b = getvalue2.value, c = getvalue3.value, d = getvalue4.value; var today = new Date(); $(".drag-1").append("<div class='card mb-3 bg-light cursor-grab border drag-1'><div class='card-body p-3'><input type='checkbox'arial-label='completed' checked='' class='checkbox' name='' value=''/><p id='workTitle1'><a id='workInfo'>" + a + "<p id='worktitle'></p>" + b + "<img id='userName' width='32' height='32' class='rounded - circle' alt'=P-'>" + c + "<a id='workShow'>" + d + "<div id='textBody' class='modal-body'></a></div></div>');
此代碼不完整,因此沒有人能夠復制您的問題並幫助您解決問題。 類名(); function 丟失並且沒有 class="submit" 的元素
除此之外,還有幾個錯誤需要修復:
這條線...
$(".drag-1").append("<div class='card mb-3 bg-light cursor-grab border drag-1'><div class='card-body p-3'><input type='checkbox'arial-label='completed' checked='' class='checkbox' name='' value=''/><p id='workTitle1'><a id='workInfo'>" + a + "<p id='worktitle'></p>" + b + "<img id='userName' width='32' height='32' class='rounded - circle' alt'=P-'>" + c + "<a id='workShow'>" + d + "<div id='textBody' class='modal-body'></a></div></div>');
應該以雙引號而不是單引號結尾。
這一行:
getvalue3 = document.getElementById("skill") //personal.
缺少一個逗號。
它目前在最后缺少以下內容:
});});
我懷疑你只復制了這么多代碼,為什么會丟失。 我只是指出它以防萬一它真的丟失了。
這些是需要解決的明顯問題。 如果這仍然有問題,您將需要提供更多代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.