i have a var value i want to pass that as id to my jquery how to that
here is my sample code
$( "span" ).click(function() {
var id=1;
$("#1>li").remove();//now it exactly removes the id 1 but how to pass var id insted of 1
});
<html >
<head>
<meta charset="utf-8">
<title>remove demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<span>hey</span>
<ul id="1">Hello
how are
<li>you?</li>
</ul>
<ul id="2">Hello
how are
<li>you?</li>
</ul>
</body>
</html>
now it exactly removes the id=1 but how to pass var id instead of 1