Hi
How to get the Id of an element after firing the event from another element which is located before first element.
Actually I have dynamically created <select> and a <span>.
I want to get the id of the <span>,after the onchange event of the <select>
Span is located after the <select>
I have used following code

$( this ).after( $( "span" ) ).id;

If it is at the same level of DOM, you could use next in JQuery (which is equivalent to nextSibling) to obtain the next element. If you want its first node in the list of the same level, you simply go up to parent and select the first child node. Or you simply use find if you know what you are looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.