GithubHelp home page GithubHelp logo

brijeshb42 / medium-style-confirm Goto Github PK

View Code? Open in Web Editor NEW
166.0 9.0 19.0 39 KB

medium.com style confirm dialog

Home Page: http://bitwiser.in/medium-style-confirm/

License: MIT License

CSS 19.07% JavaScript 28.90% HTML 52.03%
dialog-box medium dialog

medium-style-confirm's Issues

mscConfirm Not Preventing Href to confirmation

I am trying to apply mscConfirm on an anchor tag, where upon click I want to confirm user that if he is sure,
Below is the simple code.

<a class="btn btn-success"
     onclick="javascript:return mscConfirm('Are you sure you want to start this application??', function(){return true;
                                })"
                                   href="any-page.html"

                                >Start</a>

What what happens, when i click on the link, confirm boxes apears and automatically redirects to the herf, before even I click Yes or No?

Using this to delete items from storage

Great app.
I tried this to help delete items from local storage but couldn't get a way round it, any help?

<section class="content">
        <div class="demo msc-action">
            <button style="background-color: #D9383B;" id="demo2" onclick="DeleteItem()">Remove Item</button>
        </div>
</section>

<script>
document.addEventListener("DOMContentLoaded", function() {
    var demobtn1 = document.querySelector("#demo2");
    demobtn1.addEventListener("click", function() {
        mscConfirm("Remove Item", "Are you sure you want to delete this item?", function() {  
        function deleteItem(index) {      
            const cartEntries = JSON.parse(localStorage.getItem("cart"));
            cartEntries.splice(index, 1);
            localStorage.setItem("cart", JSON.stringify(cartEntries));
            window.location.reload()
    });
    });
});

</script>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.