'Retrive an ID in a textarea using Jquery

I have this code

<textarea id="boh" name="boh" rows="4" cols="50">
god save the queen for <span id="godsq">2<span> times</textarea>
<input type="text" id="risultat">

<button id="button" type="button">Click Me!</button>

I'd Like to find the value 2 and put in the input fiedl when I click the button

I tried the following code

$( "#button" ).click(function() {$("#risultat").val($("#godsq").text());});

But it doesn't give to me result



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source