全部, 我有以下代码:
$( "#searchForm" ).submit(function( event ) {
// Stop form from submitting normally
event.preventDefault();
// Get some values from elements on the page:
var $form = $( this ),
term = $form.find( "input[name='s']" ).val(),
url = $form.attr( "action" );
// Send the data using post
var posting = $.post( url, $( "#searchForm" ).serialize() );
// Put the results in a div
posting.done(function( data ) {
$( "#updated_status" ).html(data);
});
});
我想淡出刚刚发布到updated_status div的数据。我试着这样做:
$( "#searchForm" ).submit(function( event ) {
// Stop form from submitting normally
event.preventDefault();
// Get some values from elements on the page:
var $form = $( this ),
term = $form.find( "input[name='s']" ).val(),
url = $form.attr( "action" );
// Send the data using post
var posting = $.post( url, $( "#searchForm" ).serialize() );
// Put the results in a div
posting.done(function( data ) {
$( "#updated_status" ).html(data).fadeout(2000);
});
});
但是那段时间之后,新文本并没有淡出。我怎么能这样做?