4

Hi I am in need of some help. Please see my code below. Thanks in advance for any assistance.

$('#input_listName').keyup(function(){
var newList = $(this).val();

$('#btn_createList').click(function(){
    ('.ul_current').append().html(newList);
});
});
<input type="text"  id="input_listName"/>
<br/>
<button type="submit" class="btn_sendMessage" id="btn_createList">Create List</button>

<ul class="ul_current">
    <li>Item</li>
    <li>Item</li>
    <li>Item</li>
</ul>

2 Answers 2

7
$('#btn_createList').click(function(){
    $('.ul_current').append($('<li>', {
         text: $('#input_listName').val()
    }));
});

should do it.

Demo: http://www.jsfiddle.net/G8pbG/

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

Comments

1
$('#btn_createList').click(function() {    
    $('.ul_current').append('<li>' + $('#input_listName').val());
});

Demo: http://jsfiddle.net/netdreamer/uvuUe/

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.