I'm trying to make a to do-list using Bootstrap and Javascript, and every item on the list consists of a text which is user-input and three clickable glyphicons (edit, finished, remove), on which i use .pull-right to make them appear on the right of the list-item.
This works well when adding a new element altogether, but I also want to make the elements editable, and upon saving an edit the glyphicons all of a sudden appear one line below the text (and outside of the box that is the list-item for that matter).
In short, my question is: How do i get the text and the glyphicons to stay horizontally aligned when saving an edit?
$("#addText").on("click", function() {
var inText = $("#inText").val();
if(inText !== "") {
$("#inText").val("");
var theText = "<li class='list-group-item'>"+inText+"<span class='glyphicon glyphicon-remove pull-right' aria-hidden='true'></span><div class='glyphicon glyphicon-ok pull-right' id='1' aria-hidden='true'></div><span class='glyphicon glyphicon-pencil pull-right' aria-hidden='true'></span></li>";
$(".list-group").append($(theText));
}
^ This is for adding a new list-item, alignment works fine.
$("ul").on("click", "#updateText", function() {
var inText = $("#newText").val());
console.log("hihi");
if(inText !== "") {
var theText = inText+"<span class='glyphicon glyphicon-remove pull-right' aria-hidden='true'></span><span class='glyphicon glyphicon-ok pull-right' aria-hidden='true'></span><span class='glyphicon glyphicon-pencil pull-right' aria-hidden='true'></span>";
$(this).closest("li").html(theText);
}
^ This is for saving an edit, it's here the alignment gets all messed up even though I've copied the html from the other function.
I've also tried using float: right; instead of .pull-right, but to no avail.
The express framework comes with the express functions express.json() and express.urlencoded(). We have the body-parser library, which appears to do the same functions. My question is, does body-...
The express framework comes with the express functions express.json() and express.urlencoded(). We have the body-parser library, which appears to do the same functions. My question is, does body-...
Below is my sort function but I want to display the ones with a code to be at the top. I want to sort my array of objects by code, then by description. Right now, the items without a code is being ...
Below is my sort function but I want to display the ones with a code to be at the top. I want to sort my array of objects by code, then by description. Right now, the items without a code is being ...
In a swig file I want to see all available properties that it is receiving. Is there a way to access it? Or can I only access its properties? .js res.render('list.swig', result); list.swig {{ ...
In a swig file I want to see all available properties that it is receiving. Is there a way to access it? Or can I only access its properties? .js res.render('list.swig', result); list.swig {{ ...
I am trying to match a regex with some data in a file, the match function however returns null even when the match clearly exists in the data. I have tried same data and regex on RegExr and it shows ...
I am trying to match a regex with some data in a file, the match function however returns null even when the match clearly exists in the data. I have tried same data and regex on RegExr and it shows ...