How do i fetch the text within the div using id selector i.e test@test.com in this case using jQuery.
<div class="g10 edit_trader" id="email_54">test@test.com</div>
the following code fetch the value email_54
$('edit_trader').attr('id')
i tried using
$('edit_trader').attr('id').val();
$('edit_trader').attr('id').text();
$('edit_trader').attr('id').html();
nothing works.
thank you..
An id selector is prefixed with
#. So if you wanted to get the contents of an element with id = email_54 you could do this:And if you wanted to use a class selector you should prefix with .:
But of course in this case since you could have multiple elements with the same class you might get an array as a result.