jQuery live change problem
- by Milos
When I click an element from list, jQuery get class from clicked element and write it in input field. Then value from input need to be written in div#content without any action.
HTML:
<ul>
<li class="NewYork">New York</li>
<li class="Paris">Paris</li>
<li class="Moscow">Moscow</li>
</ul>
<input type="text" id="city" value="" />
<div id="content"></div>
jQuery:
$(document).ready(function() {
$('ul li').live('click', function() {
var select_value = $(this).attr('class');
$('input#city').val(select_value);
return false;
});
$('input#city').live('change', function() {
var content = $(this).val();
$('#content').text(content+' is beautiful city');
});
});