私はjQueryが初めてで、関数を理解するのに問題があります。
私はHTMLコードの次の構造を持っています:
<ul class="result">
<li id="a"></li>
<li></li> //will be added through a loop depending on input
</ul>
そして、このjQueryコード:
$(document).ready(function() { //changes are possible when the page has fully loaded
$('.inp').keyup(function() { //executes keyup function to the field class "inp"
var inp = $(this).attr('value'); //sets a variable with the value of input from class="inp"
$.post('ajax/file.php', {inp:inp}, function(data) { //posts that value to file.php as variable inp and executes the function (data) to this
$('.result').html(data); //adds the returned result into HTML content as a first element in the set of class="result" => <li>
$('.result li').click(function() { //executes click function when clicking li element
var result_value = $(this).text(); //sets a variable and prepares something as text
$('.inp').attr('value', result_value); //fills value attribute of field class "inp" with the variable result_value
$('.result').html(''); //???
});
});
});
});
今私の質問は何$('.result').html('');
ですか?