remove appended html
$(function() {
if(map_flag == 0)
$("#buttons").append(' <input type="button" value="Import" class="ui-state-default ui-corner-all" onclick="javascript:import_q();" />');
});
function upload_1()
{
$("#buttons").val('');
$("#buttons").html('')
}
In upload_1 function how to remove the html that is appended in $("#buttons") i tried $("#but开发者_开发问答tons").val(''); $("#buttons").html('');
It didnt work
<script type="text/javascript">
$(function() {
$("#buttons").append(' <input type="button" value="Import" class="ui-state-default ui-corner-all" onclick="javascript:import_q();" />');
});
function upload_1()
{
$("#buttons").html('')
}
</script>
<div id="buttons"></div>
<a href="#" onclick="javascript:upload_1();" >Clear</a>
Works fine for me... How are you initializing the upload_1 function?
$('#buttons').html('');
will replace the innerHTML
from the #buttons
element.
$('#buttons').replaceWith('');
will replace the element #buttons
itself and substitue it with ''
(nothing)
Sidenote: There is a typo in your code, a missing ;
behind .html()
.
精彩评论