How do I show the jQuery data value in the given format HTML list?

Related searches

How can I print the jQuery values as the HTML format list?

<script src=""></script>
<li class="comment author-comment">
  <div class="info">
    <a href="#">Jack Smith</a>
    <span>3 hours ago</span>
  <a class="avatar" href="#">
    <img src="{{ asset('commentui/images/avatar_author.jpg') }}" width="35" alt="Profile Avatar" title="Jack Smith" />
  <p>JQuery value is here.</p>
  $.get('{{ URL::to('comment/retrive') }}', function(data) {

You can do this:

    $.get('{{ URL::to('comment/retrive') }}',function(data){
        console.log(data); // to check the data
        $('.comment p').html(data);
});, element, key, value )Returns: Object. Description: Store arbitrary data associated with the specified element. Returns the value that was set. There is a Input Element, the task is to set its value using JQuery. Here are a few examples discussed. To understand example first few methods to know. JQuery val() method: This method return/set the value attribute of selected elements. If we use this method to return value, it will return the value of the FIRST selected element.

If you really want to use JQuery, you can do something like that :


<p id="value-container">JQuery value is here.</p>


   $.get('{{ URL::to('comment/retrive') }}',function(data){

Hope it helped.


As dm707 said, using .html() instead of .text() will treat is as HTML and not plain text.

.data(), To Donate, see this list of organizations to support from Reclaim the Block The new data value; this can be any Javascript type except undefined . by a lowercase ASCII letter in a key is replaced by the uppercase version of the letter, in alignment with the HTML dataset API. For example, given the following HTML:� The above lines alert the data values that were set on the body element. If nothing was set on that element, an empty string is returned. Calling element ) retrieves all of the element's associated values as a JavaScript object. Note that jQuery itself uses this method to store data for internal use, such as event handlers, so do

You should set id for p tag

<p id="pcontainer">JQuery value is here.</p>

then you can

   $.get('{{ URL::to('comment/retrive') }}',function(data){

append make you able to use html tags too or if its just text use:


.html(), Get the HTML contents of the first element in the set of matched elements or set the off the quotes around attribute values if they contain only alphanumeric characters. Additionally, jQuery removes other constructs such as data and event Given a document with six paragraphs, this example will set the HTML of <div� The val() method returns or sets the value attribute of the selected elements. When used to return value: This method returns the value of the value attribute of the FIRST matched element. When used to set value: This method sets the value of the value attribute for ALL matched elements. Note: The val() method is mostly used with HTML form

You can try adding your data wherever you want in a DOM using .html() or .text()

   $.get('{{ URL::to('comment/retrive') }}',function(data){

.map(), As the return value is a jQuery object, which contains an array, it's very common to call .get() To get a comma-separated list of checkbox ID s: The function can return an individual data item or an array of data items to be inserted into the resulting set. <!doctype html> A contrived example to show some functionality. Example explained: We use jQuery to loop through each table rows to check if there are any text values that matches the value of the input field. The toggle() method hides the row (display:none) that does not match the search.

jQuery.parseHTML(), data. Type: String. HTML string to be parsed. context (default: document ) By default, the context is the current document if not specified or given as null or� To retrieve a data-* attribute value as an unconverted string, use the attr () method. Since jQuery 1.6, dashes in data-* attribute names have been processed in alignment with the HTML dataset API. For example, given the following HTML: 1

Here, in the post I’ll show how using jQuery we can dynamically create unordered list along with list items by using data extracted from an XML document.

A jQuery Selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria. Simply you can say, selectors are used to select one or more HTML elements using jQuery. Once an element is selected then we can perform various operations on that selected element. The $() factory function

  • I don't know why do you stretch the process by adding id and then while appending also, you are adding data inside div. simply it can be done. see my answer
  • @JitendraAhuja yes I know we don't need div ....but I said if you he want to use html tag's too with data he can use append and div is sample