-1

I'm using to append a div inside a div where the second div is the parent of an input tag.I tried to get the value of this input tag using .val() of jquery, but am not getting any value, not even null! Here is the HTML code,

<div id="newContDiv" class="form-group">
  <div id="newDiv"></div>
</div>

In to the #newDiv I am appending:

var v = "<div id = 'coverDiv'><label id='appDivlabel'>Pancard Number *</label><div id='appDiv'><input id='panNumId' required='' type='text'name='panImg1' placeholder='Enter your Pancard number'/></div>";
$('#newDiv').append(v);`

To get the value I wrote jQuery code as

$('#panNumId').change(function () {
  var amount = $("#panNumId").val();
  alert("value appended : " + valueApp);
});

The problem here is that, when I call the element with the respective id, the element is not shown up, that is, I can't even select this element #panNumId.Is there any way that I can get the appended element.Iam not asking for an event problem, the problem is to get the element.Thank you for helping.The question which is set duplicate one,is not the answer which Iam looking for.My question is different.

Amal lal T L
  • 400
  • 5
  • 20

1 Answers1

1
$('#panNumId').change(function () {
  var amount = $("#panNumId").val();
  alert("value appended : " + amount);
});

check if value is coming.

app_dev
  • 74
  • 1
  • 2
  • 10