Code Monkey home page Code Monkey logo

Comments (7)

jewlofthelotus avatar jewlofthelotus commented on August 11, 2024

Hi @shannpersand - There's nothing built in to the plugin that would give you this functionality, but you should definitely be able to set up a new on click event for the answer inputs. You could probably modify or duplicate the event that already exists for the button:

https://github.com/jewlofthelotus/SlickQuiz/blob/master/js/slickQuiz.js#L630

And use the same checkAnswer method, you'll just need to pass that function the button associated with that question, or modify the method to not need it.

Hope that gets you started.

from slickquiz.

shannpersand avatar shannpersand commented on August 11, 2024

Thanks! I set up a new event and it works perfectly.

from slickquiz.

jewlofthelotus avatar jewlofthelotus commented on August 11, 2024

Glad to hear it @shannpersand! Thanks for using SlickQuiz!

from slickquiz.

blfeigel avatar blfeigel commented on August 11, 2024

@shannpersand would you be interested in sharing how you got this to work? I'm interested in doing the same.

from slickquiz.

shannpersand avatar shannpersand commented on August 11, 2024

@blfeigel sure, it's been a long time since I looked at this, I'm sure this is an incredibly inefficient way to do it:

https://gist.github.com/shannpersand/917535d68df2a26b35fc

You'll probably just have to change the level of selection. I was doing a quiz where the radio buttons would turn red/green on click based on if you got the question right or wrong.

from slickquiz.

blfeigel avatar blfeigel commented on August 11, 2024

I'm finally back on this and was able to get the correct response to show when you click an answer input, but it seems to have broken the next button.

// Bind "check answer" to any click on answer $(_element + ' ' + _answers).find('input[type=radio]').on('click', function(e) { e.preventDefault(); plugin.method.checkAnswer(this, {callback: plugin.config.animationCallbacks.checkAnswer}); });

Any ideas?

from slickquiz.

blfeigel avatar blfeigel commented on August 11, 2024

Figured it out, e.preventDefault(); is not needed. In this case it was preventing the input from getting the :clicked attribute, which made the next button logic return false.

from slickquiz.

Related Issues (20)

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.