[jQuery] Retrieve function signature from a list
I have a list of dynamically generated image hyperlinks that are
displayed on a page as follows:
<div class="imgBg">
<img id="imgProd" src="" alt=""/>
</div>
<div id="imgEnum">
<ul>
<li><span class="sqr1"
onmouseover="updImage('Images/aaa.01.jpg');">1</span></li>
<li><span class="sqr1" onmouseover="updImage('Images/aaa.02.jpg');">
2</span></li>
...
<li><span..>N</span></li>
</ul>
</div>
Problem: This scheme works fine when hovering over the image indexes.
On loading, I would like the first image of the list to be copied to
imgProd via jquery. How do I extract the mouseover function signature
of the first item ie. "updImage('Images/aaa.01.jpg');" ?
I tried filtering out the li list and narrow it to the first item via
the below code. varImgUR produces the correct signature:
"updImage('/WebHost4Life.Lsite1/Images/Products/Thumbs/
Audree01_md.jpg');"
jQry signature extract code:
jQuery(document).ready(function() {
// Extract span cnt from first list element
var sp0 =$("#imgEnum > ul > li span").get(0);
// Get mouseover fct signature and execute it.
var sigimgURL =sp0.attributes[0].nodeValue;
eval(sigimgURL);
});
Function eval()yields the error: "sigimgUrl is not defined"
How can I make this run or alternatively is there a more elegant
jQuery approcach to