1. ホーム
  2. javascript

[解決済み] How do I get a value of a <span> using jQuery?

2022-04-25 06:51:09

Question

This is basic.

How do I get the value 'This is my name' of the above span?

<div id='item1'>
<span>This is my name</span>
</div>

How to solved?

I think this should be a simple example:

$('#item1 span').text();

or

$('#item1 span').html();