I am fairly decent with JQuery, but there is always more to learn of course! Consider the following structure.
- <div class="container">
- <div id="label1">
- <div class="label1_1">
- </div>
- </div>
- <span class="spanID">
- </span>
- </div>
I would like to do this....
- <script type="text/javascript">
$(document).ready(function() { - var allSubElements = $('.container').returnElements();
- });
- </script
What I would like returnElements function to do is return all the elements NOT just the children, and I dont just want to "wrap" those elements, I want to return them. The function should return:
- {#label1, .label1_1, .spanID}
Notice how it specifies whether it is a class or id element. Long term what I am trying to do is right a plugin for JQuery that will enable me to PRINT any element on a page. I have the function to return the rendered CSS for an element, but I need the actual elements to call for their respective styles.
Any input would be awesome. Thanks!