CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Tracking Elements by unique internal userside identifier  (Read 914 times)

durango_d

  • Full Member
  • ***
  • Posts: 124
  • Karma: +1/-0
Hi,

Does js (or users side) maintain an internal identifier for the element...   For example if i have 3 divs with all the same id, does the user side have an internal identifier to know one from the other.  I cant assign another id i have to use the js as is to identify the element.

I am thinking that somewhere inside the  nodes, there has to be something.

if so:

What is it called?

Do i have access to that identifier?

Does the identifier change with a fresh page?  If not, can i rely on that identifier for storage and retrieval?

If not is there a way to assign a token value to the element for storage, without using id or class?

Thanks..
« Last Edit: 1 Nov 2020, 07:55:02 pm by durango_d »
Squeeze it Harley! Don't yank it!  It's not your D...!  Squeeze it !

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 787
  • Karma: +8/-0
    • Grumpy Young Man
Re: Tracking Elements by unique internal userside identifier
« Reply #1 on: 2 Nov 2020, 02:26:17 am »
My very limited knowledge says that all HTML ID’s have to be unique?
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

durango_d

  • Full Member
  • ***
  • Posts: 124
  • Karma: +1/-0
Re: Tracking Elements by unique internal userside identifier
« Reply #2 on: 2 Nov 2020, 04:14:02 am »
yes true.... i was hoping for some kind of like 64 bit identifier internally or the like, there must be something because i have 6 divs with the same id's and the users side seems to know the difference between them. 

for now what i did was gave span inside the target a unique id, then used the parentNode to pull that (1 of 6) id...  not sure how it knows which is which without that id.. but it does.....
Squeeze it Harley! Don't yank it!  It's not your D...!  Squeeze it !

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1049
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Tracking Elements by unique internal userside identifier
« Reply #3 on: 2 Nov 2020, 11:52:58 am »
because i have 6 divs with the same id's and the users side seems to know the difference between them. 
That's not a thing, and it means your code is broken gibberish nonsense.

ID's can only be used once on a page. Do not re-use them and anyone telling you otherwise needs a quadruple helping of sierra tango foxtrot uniform. They're talking out their arse.
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

durango_d

  • Full Member
  • ***
  • Posts: 124
  • Karma: +1/-0
Re: Tracking Elements by unique internal userside identifier
« Reply #4 on: 3 Nov 2020, 07:14:25 am »
The problem is that this is now the log and the garage work and it does work.   All of them have the same id starting from the chat code part but a different h3 title and different content.   But somehow the system knows the difference.

This is how its set up, i thought i was following your code, ill have to look again.   The problem is that we cant have them different or we will have to call the iife function using a id value, i dont think that will work.  Look at my last code i posted on that topic, thats how it is now, and its working.

So how does the users side know the difference?  There has to be some kind of identifier inside the Nodes somewhere.
« Last Edit: 3 Nov 2020, 07:22:36 am by durango_d »
Squeeze it Harley! Don't yank it!  It's not your D...!  Squeeze it !

durango_d

  • Full Member
  • ***
  • Posts: 124
  • Karma: +1/-0
Re: Tracking Elements by unique internal userside identifier
« Reply #5 on: 3 Nov 2020, 07:33:07 am »
here is the lot.childNodes list  they are all  id="databox" class="databox"

Quote
NodeList(37) 
[text, comment, text, div#databox.databox, text, comment,
text, comment, text, div#databox.databox, text, comment,
text, comment, text, div#databox.databox, text, comment,
text, comment, text, div#databox.databox, text, comment,
text, comment, text, div#databox.databox, text, comment,
text, comment, text, div#databox.databox, text, comment, text]


Squeeze it Harley! Don't yank it!  It's not your D...!  Squeeze it !

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1049
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Tracking Elements by unique internal userside identifier
« Reply #6 on: 3 Nov 2020, 10:25:33 am »
Why did you add id's in the first place? The park/unpark code I wrote DOESN'T USE ID'S in the first place for each and every blasted sub-child.

Multiple instances of the same ID is gibberish nonsense, The code I provided doesn't care about ID's so that should work, but anything that actually uses ID's won't.

WHY? WHy are you adding the same ID to everything?!? What nonsensical trash are you doing where that would/should even BE a thing?
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

durango_d

  • Full Member
  • ***
  • Posts: 124
  • Karma: +1/-0
Re: Tracking Elements by unique internal userside identifier
« Reply #7 on: 3 Nov 2020, 03:01:43 pm »
I know, i didnt have the id's before, but adding the DND (drag n drop) i had to have someplace to put the draggable attribute to true, where else would i put it, and they all have to be grouped, it left me no choice.

It does work surprisingly, the only bug is that it does not always go back to the same spot as you can see in the video.   

Could i assign the resizable via the iife we already have?  or maybe a separate iife? and then i can remove the id's   

Also remember that i will need to identify each block somehow so i can save its location for users.
« Last Edit: 3 Nov 2020, 07:09:32 pm by durango_d »
Squeeze it Harley! Don't yank it!  It's not your D...!  Squeeze it !

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1049
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Tracking Elements by unique internal userside identifier
« Reply #8 on: 4 Nov 2020, 08:32:00 am »
I know, i didnt have the id's before, but adding the DND (drag n drop) i had to have someplace to put the draggable attribute to true, where else would i put it, and they all have to be grouped, it left me no choice.
The what now? That doesn't make any sense. What the blazes does the draggable attribute have to do with it having an ID?

And yes, if you're just setting draggable to true, do it in the existing loop if it's on the same elements and/or parents/siblings of same.
« Last Edit: 4 Nov 2020, 08:34:36 am by Jason Knight »
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

durango_d

  • Full Member
  • ***
  • Posts: 124
  • Karma: +1/-0
Re: Tracking Elements by unique internal userside identifier
« Reply #9 on: 4 Nov 2020, 09:04:28 am »
OH my bad, i thought assigning draggle requried an id, i did not know it could be done on just a naked div... mmm interesting...  yes i will try assigning to via the js loop then i can save some code too... :)    thanks
Squeeze it Harley! Don't yank it!  It's not your D...!  Squeeze it !

 

SMF spam blocked by CleanTalk

Advertisement