I have the following jsfiddle, code below:
HTML:
<div id="one" style="display:none">One</div>
<div id="two" style="display:none">Two </div>
<div id="three" style="display:none">Three</div>
<div id="output"></div>
jQuery:
$("#output").html($("#one,#two").html());
I can make it work with one selector, what I am trying to do is use multiple selectors, I seem to be going about it the wrong way. Can someone point me in the right direction?
Thanks
.html()will only get the content from the first element matching the selector rule:Source: http://api.jquery.com/html/
If you want content from two elements you should do:
See Demo: http://jsfiddle.net/sshg7/2/