Giter Site home page Giter Site logo

Click event about icheck HOT 9 CLOSED

drgullin avatar drgullin commented on June 30, 2024
Click event

from icheck.

Comments (9)

drgullin avatar drgullin commented on June 30, 2024

This scheme was replaced in version 0.8, because of the bugs related to customized inputs inside labels and different way of handling key events in some browsers.

return false also prevents an infinite loops in some cases.

Since iCheck is used for customization, I hope we don't need to fire direct clicks on an inputs.

I would like to add a toggle method instead, which would work like an ordinary click:

$('input').iCheck('toggle');

:checkbox checked => uncheck
:checkbox unchecked => check
:radio checked => do nothing
:radio unchecked => check current, uncheck others

from icheck.

baurez avatar baurez commented on June 30, 2024

Yes. But the goal of plugin like icheck is to make the input more
beautiful. And it will be easy to add un any project. And all the normal
évent attached to the original input must be preserved.

For example, in ASP.net we can easyly make a submit of thé form when thé
checkbox state change... This possibility is triggered by the click
évent... With icheck this never happened.

In the same way, original event on chzckbox could be executed by thé icheck
no ?

from icheck.

drgullin avatar drgullin commented on June 30, 2024

iCheck doesn't use click event to make changes, it works directly with input's state instead.

I hope ASP.NET can handle ifChanged callback. It has almost the same effect, as a click event.

This code:

$('input').click(function(){
  // submit
});

Should be replaced with:

$('input').on('ifChanged', function(){
  // submit
});

from icheck.

drgullin avatar drgullin commented on June 30, 2024

I've added a toggle method. It can be used instead of the click event. To handle clicks, use ifClicked callback.
f5da1d7

from icheck.

drgullin avatar drgullin commented on June 30, 2024

Next version will support click handler on inputs.

from icheck.

desduvauchelle avatar desduvauchelle commented on June 30, 2024

Not sure if it's linked. But how come when I click a checkbox it doesn't toggle the actual checkbox state (ie from checked to unchecked) when I look at the source code?

Here is my setup:

$('input').iCheck({
    checkboxClass: 'icheckbox_square-blue',
    radioClass: 'iradio_square-blue',
    increaseArea: '20%' // optional
});

$('input').on('ifChanged', function(event){
    alert(123);
});

But nothing happens.

from icheck.

ambasador avatar ambasador commented on June 30, 2024

Hi this is working for me fine

$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
$('input').iCheck('update');
$('input ').on('ifClicked ', function(event) {
if ($('input').prop('checked')) {
alert('1');
} else {
alert('2');
});

from icheck.

desduvauchelle avatar desduvauchelle commented on June 30, 2024

Thanks for the super fast feedback.

screen shot 2013-08-15 at 19 37 02

I just added your code to my site...and it doesn't work. The checkboxes are nice and sexy, but no alerts on click...Might be collision with a script...hummm.

from icheck.

neylith avatar neylith commented on June 30, 2024

Hi, @desduvauchelle I have your problem with iCheck,

$('input').on('ifChanged', function(event){
alert(123);
});

No work. How did you fix it?

Thanks

from icheck.

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.