Jquery Checkbox check/ticked/clicked on click on some event triger in Ruby On Rails Enviornment

In Ruby on Rails Enviornment Checkbox/checkboxes was not clicking on some event trigger šŸ™‚ At last I found the way to do:

Infact in rails when you creat a checkbox it will creat a span as its parrent element when you click on checkbox

it will two actions

1) add attribute to checkbox checked=’checked’

2) add a class named checkedĀ to checkbox’s parrent span

so the code what you need with some modifications is:


function check_uncheck(value){
  $('.under_all input:checkbox').each(function() {
  $(this).attr('checked', value) // step#1
  $(this).parent().toggleClass('checked',value)// step#2

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Posted in Client Side Technologies, JQuery, Ruby Little Codes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: