Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to access the dom by knowing the value of a node && Getting the index of accordion by just knowing value
    text
    copied!<p>I have 2 questions:</p> <p>1) Since I have similar structure for the html contents and the only difference is that class title contents are different. I tried using $(div .title:contains("cat")) also $(div .title).text()="cat")</p> <p>2)How can I get the index of the accordion by just checking the $(div a) contents are required ones. I tried using $(div a).text()=="cat"</p> <p>Check the codes here:</p> <p>HTML1 contents</p> <pre><code> &lt;div class="mod moduleselected" id="mod969"&gt; &lt;div class="content module moduleselect"&gt; &lt;div class="hd" &gt;&lt;div class="inner"&gt; &lt;div class="title"&gt;cat&lt;/div&gt; &lt;ul class="terminallist"&gt;&lt;/ul&gt; &lt;ul class="buttons"&gt; &lt;li class="help"&gt;&lt;/li&gt; &lt;li class="show" &gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="mod moduleselected" id="mod969"&gt; &lt;div class="content module moduleselect"&gt; &lt;div class="hd" &gt;&lt;div class="inner"&gt; &lt;div class="title"&gt;rat&lt;/div&gt; &lt;ul class="terminallist"&gt;&lt;/ul&gt; &lt;ul class="buttons"&gt; &lt;li class="help"&gt;&lt;/li&gt; &lt;li class="show" &gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="mod moduleselected" id="mod969"&gt; &lt;div class="content module moduleselect"&gt; &lt;div class="hd" &gt;&lt;div class="inner"&gt; &lt;div class="title"&gt;dog&lt;/div&gt; &lt;ul class="terminallist"&gt;&lt;/ul&gt; &lt;ul class="buttons"&gt; &lt;li class="help"&gt;&lt;/li&gt; &lt;li class="show" &gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Accordian</p> <pre><code> &lt;div id="dia"&gt; &lt;div id="dialog" title="Detailed FeedBack "&gt; &lt;div id="accordion"&gt; &lt;h3&gt;&lt;a href="#"&gt;dog&lt;/a&gt;&lt;/h3&gt; &lt;h3&gt;&lt;a href="#"&gt;cat&lt;/a&gt;&lt;/h3&gt; &lt;h3&gt;&lt;a href="#"&gt;rat&lt;/a&gt;&lt;/h3&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Javascript</p> <pre><code> $('div .title').mouseover(function() { if($("div a").text().indexOf("cat")!=-1) { $("#accordion").accordion("activate", 1); } $('div .title').mouseleave(function(){$("#accordion").accordion("activate", -1); }); }); </code></pre> <p>Here is what I am trying to do with this javascript code. When I mouse over the cat contents I want the accordion with cat contents to open. And when I leave it to close the accordion selection.</p> <p>When I hover my mouse over the html contents cat ,rat. It should side by side open the accordion button of those contents. Example: I hovered over rat (of html contents) I should see accordion rat open (or active i.e. contents visible).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload