I am a new member to this site...have used it for a long time but never a member but i have not been able to find an answer so I thought I should ask.
I am new to working with jquery and html selectors so please forgive me if this is easy question but..
I am using HTML5, css, and jquery. I created a horizontal drop down menu that is three levels deep. I want to select html pages to load into an iframe based on the user's selection (each page represents a report). when I select an inner il selection, I get its id, but then it continues looping through the li
and ul
until it ends at the parent li
.
==> this is the UL > IL > IL tree:
<li id="" onclick="processRequest(id)">
<a href="#">link 4</a>
<ul class="sub1">
<li id="sublink41" onclick="processRequest('sublink41.html')"> <a href="#">-link 4.1</a></li>
<li id="sublink42" onclick="processRequest(id)"> <a href="#">-link 4.2</a></li>
<li id="sublink43">
<a href="#">-link 4.3</a><span class="rarrow">▶</span>
<ul class="sub2">
<li id="sublink431" onclick="processRequest(id)"><a href="#">-- link 4.3.1</a></li>
<li id="sublink432" onclick="processRequest(id)"> <a href="#">-- link 4.3.2</a></li>
==> this is the jQuery function:
function processRequest(value) {
var selectedValue = value;
console.log('selected values is: '+selectedValue);
$('#frameIt').replaceWith('<iframe id="frameIt" src= "' + selectedValue + '">')
}
I want to use the ID to identify the correct html file to load into the iframe but here is what I see when I inspect this via chrome tools...
default.aspx:71 selected values is: sublink41.html
default.aspx:71 selected values is:
as you can see, it finds the correct value but then it continues to the parent LI and ends there... I have put in some time trying to find a solution to this but have not been able to...any help is appreciated.