Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8310241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:23:22+00:00 2026-06-08T19:23:22+00:00

<!doctype html> <html> <head> <title>jQuery Tagit Demo Page (HTML)</title> <script src=demo/js/jquery.1.7.2.min.js></script> <script src=demo/js/jquery-ui.1.8.20.min.js></script> <script

  • 0
<!doctype html>
<html>
<head>
  <title>jQuery Tagit Demo Page (HTML)</title>
  <script src="demo/js/jquery.1.7.2.min.js"></script>
  <script src="demo/js/jquery-ui.1.8.20.min.js"></script>
  <script src="js/tagit.js"></script>

  <link href="demo/css/demo.css" rel="stylesheet" type="text/css"/>
  <link rel="stylesheet" type="text/css" href="css/tagit-stylish-yellow.css">

  <script>


    $(document).ready(function () {


    var list = new Array();
     var availableTags = [];

     $('#demo2').tagit({tagSource:availableTags});


     $('#demo2GetTags').click(function () {
        showTags($('#demo2').tagit('tags'))
      });

     /*
    $('li[data-value]').each(function(){
        alert($(this).data("value"));
    });*/

    function showTags(tags) {

        var list = new Array();
        console.log(tags);
        var string;
        for (var i in tags)
          string +=    new String(tags[i].value)

            console.log(string);
        }


    });
  </script>
</head>
<body>

<div id="wrap">

<div class="box">
  <div class="note">
    You can manually specify tags in your markup by adding <em>list items</em> to the unordered list!
  </div>

    <ul id="demo2" data-name="demo2">
        <li data-value="here">here</li>
        <li data-value="are">are</li>
        <li data-value="some...">some</li>
        <!-- notice that this tag is setting a different value :) -->
        <li data-value="initial">initial</li>
        <li data-value="tags">tags</li>
    </ul>

  <div class="buttons">
    <button id="demo2GetTags" value="Get Tags">Get Tags</button>
    <button id="demo2ResetTags" value="Reset Tags">Reset Tags</button>
    <button id="view-tags">View Tags on the console </button>
  </div>
</div>

</div>
<script>
</script>
</body>
</html>

my problem with this code is that this function

function showTags(tags) {

            var list = new Array();
            console.log(tags);
            var string;
            for (var i in tags)
              string +=  tags[i].value;
                console.log(string);
            }
        });

if I did that i returns to me an “undefined” and then after that some values of the list items. but if I changed that function to this one

function showTags(tags) {

        var list = new Array();
        console.log(tags);

        for (var i in tags)
          string +=  tags[i].value;

            console.log(string);
        }


    });

it only returns me the word “tags” why is it like that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:23:24+00:00Added an answer on June 8, 2026 at 7:23 pm

    you need to initialize string. The += operator appends a value, but since string has no value there’s nothing to append to.

    var string = "";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<!doctype html> <html> <head> <title>jQuery Tagit Demo Page (HTML)</title> <script src=demo/js/jquery.1.7.2.min.js></script> <script src=demo/js/jquery-ui.1.8.20.min.js></script> <script
<!DOCTYPE html> <html> <head> <link rel=stylesheet type=text/css href=styles/common.css> <script src=http://code.jquery.com/jquery-latest.min.js></script> <script type='text/javascript'> $(function() {
I have this code: <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <link href=@Url.Content(~/Content/Site.css) rel=stylesheet type=text/css />
<!DOCTYPE html> <html> <head> <title></title> <script src=assets/js/jquery.js type=text/javascript></script> <script src=assets/js/jquery.validate.min.js type=text/javascript></script> <script type=text/javascript> $(document).ready(function()
<!DOCTYPE html> <html> <head> <title>Site :: </title> <link rel=stylesheet media=screen href=css/wicahost.css /> <link rel=stylesheet
I have a layout page thusly <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <script src=@Url.Content(~/Scripts/jquery-1.7.1.min.js) type=text/javascript></script>
my code is: <!DOCTYPE html> <html> <head> <title>Demo</title> <meta charset=utf-8/> <script src=https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js type=text/javascript></script> <script
my code http://jsfiddle.net/4Ub95/ <!DOCTYPE html> <html> <head> <title>example</title> </head> <body> <script src=libs/jquery-1.7.2.js></script> <script> $(function(){
Here's the literal HTML markup I have: <!DOCTYPE html> <html> <head> <title>Register</title> <link href=/Content/Site.css
I have the following code: <!DOCTYPE html> <html> <head> <script src=http://code.jquery.com/jquery-latest.min.js></script> <meta name=viewport content=initial-scale=1.0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.