What is html() method?

 Posted by Rajnilari2015 on 12/19/2015 | Category: jQuery Interview questions | Views: 2187 | Points: 40

html(content) method replaces the contents of the element
<!DOCTYPE html>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
$('#myspan').html('This is a <i>italic text</i>.This is another <i>italic text</i>.');
<button id="btn1">Exampleof html(Content)</button>

<span id="myspan">This is a <b>bold text</b>.This is another <b>bold text</b>.</span>


When we click on the "Exampleof html(Content)" button , the output becomes
<span id="myspan">This is a <i>italic text</i>.This is another <i>italic text</i>.</span>

This indicates that the inner html content of the span tag has been replaced .

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Margaretrmartin on: 12/29/2015 | Points: 10
In HTML, one can specify two different submission methods for a form. The method is specified inside a FORM element, using the METHOD attribute. The difference between METHOD="GET" (the default) and METHOD="POST" is primarily defined in terms of form data encoding.


Login to post response