<big> <table > <tr> <td id="UserMenu"> <ul style="margin-left:590px"> <li id="menu01User" style="color:red; float:left;padding:5px; list-style:none"> <a href="##" style="text-decoration:none">User 1</a> </li> <li id="menu02User" style="color:red; float:left;padding:5px; list-style:none"> <a href="/Menu/UtilityMenu" style="text-decoration:none">User 2</a> </li> <li id="menu03User" style="color:red;float:left;padding:5px; list-style:none"> <a href="##" style="text-decoration:none">User 3</a> </li> </ul> </td> </tr> </table></big>
<input id="btnClick" type="button" value="Processing"/> <div id="NestedMenu" style="display:none"></div>
$(document).ready(function () { var Ids = []; $("#btnClick").click(function(){ $.ajax({ cache: false, type: "GET", url: "/Menu/UserMenu", success: function (data) { debugger; $("#NestedMenu").innerHTML=data; $("#UserMenu").find("li").each(function () { Ids.push($(this).attr("id")); alert(Ids); }); }, Error: function (data) { alert("Error"); } }); });
var arrayIDs = []; $('#UserMenu ul li').each(function (index,li) { arrayIDs.push(li.id) }); alert(arrayIDs.join(',')); //menu01User,menu02User,menu03User
var IDs = []; $('#UserMenu ul li').each(function(){ var _id = parseInt($(this).val()); IDs.push(_id); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)