Solved

Enter only New Table Rows

Posted on 2010-11-15
2
301 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
ID: 34136662
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
ID: 34136930
That worked perfectly. Thank you.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

839 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