Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to append
  • in
      using jquery.I Done it successfully with following line:

      JavaScript
      var ChosedItem = $("#chosedItem");
      ChosedItem.append('<li id=" + $(this).attr(" limit=" + $(this).attr("><span>' + $(this).children(0) + '</span></li>');

      in this #chosedItem is div id where the
        exist

        But the Problem in my case is if my
      • items contain spaces.then it not added after[0]th position of children because i am using chlidren(0).what i use in place of children(0) to add
        • items that contain multiple spaces.

          Regards
          Jeet Nim
Posted
Updated 11-Jun-12 0:55am
v2
Comments
Sridhar Patnayak 11-Jun-12 6:55am    
Added <pre> </pre> tags

1 solution

I don't even want to know how if the code you posted does even work.
JavaScript
var notWhatYouWanted = false;
var $t = $(this);
var $ci = $('#chosedItem');
var idString = 'whatever';
if (notWhatYouWanted) {
	idString = $('#selector').attr('whatever');
}
var $li = $('<ul><li /></ul>').attr('id',idString).text($t.children(0).text());
$ci.append($li);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900