Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Check if the same text is repeated javascript todo-app

$('#add-items').click(function(event) {
    var item = $('#todo-list-item').val().trim();
    let itemCount = $("#list-items li").filter((i, li) => {
        let text = $(li).text().trim().toLowerCase();
        console.log(text)
    }).length;

    if (itemCount > 0) {
        alert("There is already such a task");
        return;
    }

    if (item && itemCount === 0) {
        $('#list-items').append("<li><input class='checkbox' type='checkbox'/>" + item + "<a class='remove'>x</a><hr></li>");
        $('#todo-list-item').val("");
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: cycle 2 
Javascript :: Ajax in wordpredss 
Javascript :: configuring styled component to support ssr and hydration 
Javascript :: transform js to typescript 
Javascript :: javascript complex literal 
Javascript :: react: render dynamic component from json 
Javascript :: buiding react project 
Javascript :: react native class component short code 
Javascript :: Compare a Boolean with another value 
Javascript :: alert title change 
Javascript :: Plumsail add a button to the left side of the toolbar, which will be hidden until an item is selected 
Javascript :: terraform for loop json 
Javascript :: getderivedfromstate alternative 
Javascript :: folder array randomizer 
Javascript :: react-icons/vsc 
Javascript :: Examples of correct code for the { "typeof": true } option with global declaration: 
Javascript :: angularjs Both outer and inner divs have ng-click and when I click on the inner div, both ng-clicks execute. How to prevent that 
Javascript :: directive with ng-if not rendering in Angular.js 
Javascript :: Angular.js : recursive call to an $mdDialog controller 
Javascript :: How to pass React Native Component as a JSON object 
Javascript :: How to hover over data inserted from JSON 
Javascript :: perl and regular expression for text extraction pdf 
Javascript :: Node.js and Express session handling - Back button problem 
Javascript :: morgan 
Javascript :: coercion in javascript mdn 
Javascript :: Creating A Promise With JSON 
Javascript :: testing code through local server using express.js 
Javascript :: datatables data in one line 
Javascript :: react_devtools_backend.js:4026 Warning: Cannot update a component (`BrowserRouter`) while rendering a different component (`Login`). 
Javascript :: Error: Invalid route module file 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =