Solved

Enter only New Table Rows

Posted on 2010-11-15
2
297 Views
Last Modified: 2012-05-10
Now I need to make sure that I only enter each combination of select option and checkbox value once into the table and not multiple times. I am thinking I need to use contains().

Any help will save me time.

Thank you
sshivanna
0
Comment
Question by:sshivanna
2 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
Comment Utility
you need not search each and every value in the table. Just make sure that you give the id value of a  row based on the value of checkbox value, so that before adding the value in table you just need to check if an element based on that value exists or not, ie

if the value of selected checkbox is val1, then make sure that it always goes in row of id value tr_val1, so before creating a new row, just check if an element exists with the same name, by
var element = document.getElementById("tr_"+checkBoxValue);
if (element == null)
{
   alert("element does not exists, so this value is not in the table now");
}

hope this helps
0
 
LVL 2

Author Comment

by:sshivanna
Comment Utility
That worked perfectly. Thank you.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now