'Best' way to pull data relative to a div?

Posted by acidzombie24 on Stack Overflow See other posts from Stack Overflow or by acidzombie24
Published on 2010-04-16T04:06:23Z Indexed on 2010/04/16 4:13 UTC
Read the original article Hit count: 202

Filed under:
|
|

This answer suggested i should put my data in JS instead of a textarea.

Thinking about it i could have scripts and do something like myarray[i]="data" where i is the index of my for loop. However when i click a div how do i find out what i is? I have used var data = $(this).parent('.parent').find('.valuestr').eq(0).val(); which is extremely simple. Should i use a script or should i continue to do it with a textarea? if i should use a script 1) Whats the easiest way to find i and 2) Is it bad pratice to have dozens or hundreds of <script> in my html? or i can go through the loop twice but i still dont know the easiest way to find i. I would have to store it somewhere or go through multiple tags and count them.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html