Change items userdata

Select Item  
(Click menu item to select)
Current UserData ("data")  
UserData Name  
UserData Value  
</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Change items userdata</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script>
		var myMenu;
		var mid;
		function doOnLoad() {
			myMenu = new dhtmlXMenuObject({
				parent: "menuObj",
				icons_path: "../common/imgs/",
				xml: "../common/dhxmenu.xml",
				onclick: menuClick
			});
		}
		function menuClick(id) {
			document.getElementById("item").innerHTML = id + " ("+myMenu.getItemText(id)+")";
			var ud = myMenu.getUserData(id, "data");
			document.getElementById("item_ud").value = (ud!=null?ud:"");
			mid = id;
		}
		function update() {
			var data = document.getElementById("item_new_ud").value;
			myMenu.setUserData(mid, "data", data);
		}
	</script>
</head>
<body onload="doOnLoad()">
	<div style="height: 250px;"><div id="menuObj"></div></div>
	<div>
		<table border="0" cellspacing="2" cellpadding="2">
			<tr>
				<td>Select Item</td>
				<td width="10">&nbsp;</td>
				<td><div id="item">(Click menu item to select)</div></td>
			</tr>
			<tr>
				<td>Current UserData ("data")</td>
				<td>&nbsp;</td>
				<td><input id="item_ud" type="text" value="" disabled="true"></td>
			</tr>
			<tr>
				<td>UserData Name</td>
				<td>&nbsp;</td>
				<td><select disabled><option>data</option></select></td>
			</tr>
			<tr>
				<td>UserData Value</td>
				<td>&nbsp;</td>
				<td><input id="item_new_ud" type="text" value=""> <input type="button" value="Update" onclick="update();"></td>
			</tr>
		</table>
	</div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.