Reputation: 252
Scenerio: I have some divs populated through foreach loop
like below
<div id="div1"><input type="hidden" value="1"></div>
and I am populating couple of divs with div(1,2,3) as id
and hidden input field with same ids
In my jQuery/Ajax call I am doing like below
$.ajax({
type: 'get',
url: 'URL to Server',
data: 'id=' + $("#div"+ here I want to get the id of input tag);
For example if I want to get the id of input filed with id="2"
how can I get it ?
Upvotes: 0
Views: 774
Reputation: 711
if i am getting you right then you should do like this
data: 'id=' + $("#div2 input").attr('id')
$("#div2 input")
will give you nested input field
Upvotes: 1