How to use array in jquery?
Hi
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
var item = $("p").toArray();
item[0].append("<p>hello</p>");
});
});
</script>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Insert content at the end of each p element</button>
</body>
</html>
Can anybody tell me why line in bold letters is not working?
If I use "
alert(item[0].innerHTML);
instead of line in bold
It will work.
Waiting for your response