0
   $(function() {
           if(map_flag == 0)
              $("#buttons").append('&nbsp;&nbsp;<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 $("#buttons").val(''); $("#buttons").html('');

It didnt work

Hulk
  • 32,860
  • 62
  • 144
  • 215
  • Your `.html('')` version should work. Are you certain the `upload_1()` is getting called? Have you tried placing a simple `.alert()` inside that function? – user113716 Aug 24 '10 at 13:51

2 Answers2

0
$('#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().

jAndy
  • 231,737
  • 57
  • 305
  • 359
0
<script type="text/javascript">
   $(function() {
              $("#buttons").append('&nbsp;&nbsp;<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?

bradenkeith
  • 2,397
  • 1
  • 17
  • 26