0

I have coded the jQuery below, which should display the input value when clicked. I have tested the code, but soes not seem to display the value like it should. Any help with errors is appreciated.

http://jsbin.com/ivahit

HTML

<span id='msg'></span>

<input type='text'>

<button id='get'>Get</button>

jQuery

$("button:#Get").click(function () {

$('#msg').html($('input:text').val());

});

1 Answer 1

3

Replace this

$("button:#Get").click(function () {

with this:

$("#get").click(function () {

ID is case sensitive and also button:#Get is not a proper selector.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.