I am trying to find out what values the users pick for my element.
in my variable var1. it contains.
<select>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select>
<input type='text'>
<input type='text'>
<input type='text'>
I can just do var1.value to get the user selected value.
However, I have another var2 showing
<div>
<a href='#' id='1'>test1</a>
<a href='#' id='2'>test2</a>
<a href='#' id='3'>test3</a>
</div>
I want to get the selected id from the <a>
I am not sure how to get it.
Does anyone has an idea? Thanks a lot.
I’m not sure if this is what you want, but if you want to get id of clicked anchor tag then use this:
You may want to use this version (just give your div
your-div-idid):