簡體   English   中英

我想在我用.Net 創建的待辦事項表中添加一個字段卡,但我不知道我到底哪里出錯了

[英]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

Html

我的目標是通過使用添加 html 元素按鈕旋轉 javascript 來添加 dom 元素。 當您單擊添加時,模式打開並且在填寫必要的輸入后,需要通過說添加將卡片添加到表中,但是出現了問題,我無法弄清楚發生了什么。我想 state 那我已經調查了這個問題。
 <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>

JavaScript

在這里,我嘗試通過調用元素 ID 來完成我提到的操作。
 //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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM