Hi,

I am new to web development so please bear with me, i am looking to create statistic calculators like f test etc.

In order to do that,

i need to provide input fields to enter multiple numbers in input area along with providing ability to copy paste data from a spreadsheet.

I am planning to use tables to create these input fields. How can i collect data from these rows and perform calculations on them like calculating mean(average). Please note that as idea is to provide ability to copy/paste data, rows will be added dynamically so how can i handle that part also.

Thanks
Akhil

You could have a click on a row call a function that will collect all the values in said row and insert them into the calculator fields. I would suggest using jQuery for ease and speed. You could use

  • selectors for selecting certain elements
  • .click() for registering a row click
  • .after() and .append() to attach new rows to a table
  • .val() for getting/setting the value of an input
  • .html() for getting/setting the inner html of an element (i.e. TD)

You could give every row a number and use that as an identifier for the click function, or you could use the keyword this to get the row element the click was made on.

jQuery would indeed be excellent for this task. If you don't know it yet, I suggest you read some tutorials. What Traevel says will also be much clearer if you have a basic understanding of what you can do with Javascript / jQuery.

Thanks Traevel and minitauros for your great suggestions, i have some ground in jquery and javascript, but i wasn't able to think around it the way you guys have explained it. Thanks a lot for your suggestion, these pointers are going to be great starters for me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.