RailRhoad
RailRhoad

Reputation: 2128

jQuery selecting row inserted using

I'm successfully inserting a row into my table via

$('#fbs tr:last').after('<tr><td><input id="vm" type="checkbox" /></td></tr>');

However after that I'm trying to select $('#vm') and not receiving anything. Everything looks right but jQuery isn't finding the element.

Upvotes: 1

Views: 90

Answers (1)

Yuriy Faktorovich
Yuriy Faktorovich

Reputation: 68717

The following alerts one, please post more code:

<html>
  <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
     $('#fbs tr:last').after('<tr><td><input id="vm" type="checkbox" /></td></tr>');
     alert($('#vm').length);
});
</script>
  </head>
  <body>
      <table id="fbs">
        <tr><td>first</td></tr>
      </table>
  </body>
</html>

Upvotes: 1

Related Questions