1

I have been trying hard to get the data from the clicked checkboxes using jquery but not able to get data of one variable.

I want to save like for example if i click on 2-3 time and day is monday and when i click on save time sheet it should save these values into database but i am not getting value of time in variable ,but i am getting value of day when i alert it on submit.

Check this link for getting clear idea. calendar

code

2
  • can you post the specific code you are having problems with here, (and maybe illustrate the problem using jsfiddle), that way the solution to your problem can help other people with the same problem who visit this site. Commented Jul 21, 2014 at 5:36
  • why don't you use [data variables] instead (broken-links.com/2010/11/18/data-attributes-in-html-and-jquery) Commented Jul 21, 2014 at 5:47

1 Answer 1

1

Your issue is this line

$('input').click(function()

It sets your text var when you click on a checkbox, but when you click on your submit button, which is also an input, it overwrites the text value.

Use the :not() selector, so that it does not bind your click function when the input is the select button

$('input:not(#submit)').click(function()

see this jsFiddle example, using :not(#submit) - http://jsfiddle.net/wBNGP/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Sean , it worked. Also , how can i get multiple checkbox values in a variable as it is showing only the last checked value on alert? I am beginner in jquery ,any help will be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.