Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
c# ASPNET rightclick event
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Damien" data-source="post: 481838" data-attributes="member: 72299"><p>You're issue is you have no way to distinguish which content you're getting. Since you have 2 elements with the id "myDiv", it always returns the first one.</p><p></p><p>What you need to do is create a unique id (a counter works) and parse that into your element, something like "myDiv-{count}". Then give your button an id of the count so you can retrieve it in the event listener using "event.target.id", finally you can get the element using that id "document.getElementById('myDiv-' + id)".</p></blockquote><p></p>
[QUOTE="Damien, post: 481838, member: 72299"] You're issue is you have no way to distinguish which content you're getting. Since you have 2 elements with the id "myDiv", it always returns the first one. What you need to do is create a unique id (a counter works) and parse that into your element, something like "myDiv-{count}". Then give your button an id of the count so you can retrieve it in the event listener using "event.target.id", finally you can get the element using that id "document.getElementById('myDiv-' + id)". [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
c# ASPNET rightclick event
Top