JavaScript How can I tie a String value to a <li>-tag, as a hidden parameter?

I am extracting data from a database that I do not administer. It is a single list, and the important values are:

  • Folder Name
  • Index Integer
  • UID (unique identification) String
  • Filename

I have successfully created a Tree-structured browser, based on a model using <ul> and <li> tags. I had also implemented action listeners on double click, that found the id, and acted accordingly. The identifications were stored, and found as a value-parameter to the individual <li>'s that represented the leaves, or filenames.

However it turns out that the Index numbers are not unique. I expected them to be, even though there were a column for UID's. I tried to set the value to be the UID String. It works in my browser, as a snippet of my generated HTML code shows:

<li role="treeitem" value="1581f20c-0ef9-4c21-a8ab-a407da310cf5" ... >

However, when I retrieve the value, and save it to database, it only gets the numeric value that appears ahead of the first non-numeric character. In this case 1581. I've checked, and come to the conclusion that the value-parameter only accepts numeral values, which really sucks for me...

Are there any other ways to tie a non-displayed UID String to a HTML-list element?

EDIT 2:

I removed my previous edit, due to a realization of what my misunderstanding was. Custom data tags needs the syntax "data-variablename", and when retrieving it, I should ommit the "data-", and just get the variablename.

Answer:1

value is already an html attribute. So the browser try to fix your value when you use it. Try to use a custom attribute like data-value :

<li role="treeitem" data-value="1581f20c-0ef9-4c21-a8ab-a407da310cf5" ... >
Answer:2

Try this:

HTML:

<li data-uid="[your-UID-here]">

jQ:

$("li").data("uid");

Answer:3

I want to recognize "Str","Int","[Str]","[Int]","[[Str]]",... I thought I could do something like (Str|Int|\[\1\]) where \1 self references the group. I know from formal language theory that ...

I want to recognize "Str","Int","[Str]","[Int]","[[Str]]",... I thought I could do something like (Str|Int|\[\1\]) where \1 self references the group. I know from formal language theory that ...

I was trying to test using JavaScript scripts to add content to a template at the time of processing by a PDF render-er, specifically Apache FOP. I know that XSL can call a javascript file that can in ...

I was trying to test using JavaScript scripts to add content to a template at the time of processing by a PDF render-er, specifically Apache FOP. I know that XSL can call a javascript file that can in ...

  1. javascript file write example
  2. javascript file write append
  3. javascript file write
  4. javascript file write local
  5. javascript file write api
  6. javascript file write json
  7. javascript file write read
  8. javascript file write html
  9. javascript file write nodejs
  10. javascript file write csv
  11. javascript write file to disk
  12. javascript write file to local disk
  13. javascript write file to server
  14. javascript write file sync
  15. javascript write to text file
  16. javascript write file line by line
  17. javascript write file to directory
  18. javascript write file async
  19. javascript write file from browser
  20. javascript write file client side

On the Node-Webkit web site (https://github.com/rogerwang/node-webkit/wiki/File-dialogs) it says to use the <Input type="file"> to bring up a file picker dialog, and then listen for the change ...

On the Node-Webkit web site (https://github.com/rogerwang/node-webkit/wiki/File-dialogs) it says to use the <Input type="file"> to bring up a file picker dialog, and then listen for the change ...

  1. node js saveas

The ember documentation states that there is a finally handler available on Promises: http://emberjs.com/api/classes/Ember.RSVP.Promise.html#method_finally However, using finally on a promise yields ...

The ember documentation states that there is a finally handler available on Promises: http://emberjs.com/api/classes/Ember.RSVP.Promise.html#method_finally However, using finally on a promise yields ...