78
rated 0 times
[
81]
[
3]
/ answers: 1 / hits: 19766
/ 7 Years ago, tue, august 29, 2017, 12:00:00
I want to get the text of the input text field on click of the go button. I have read a few tutorials on this, followed them step by step, but still failed to do so. Here is my code :
function go() {
content.html($(#textfield).value);
}
<!DOCTYPE html>
<html>
<head></head>
<body>
<div id=content>
<input type=text id=textfield>
<button type=button id=btn onclick=go()>Go</button>
</div>
<script type=text/javascript src=https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js></script>
</body>
</html>
May I ask what is wrong with it?
More From » jquery