Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck if the selected link match in multiple given links
    primarykey
    data
    text
    <p>i have the following playlist rows , these rows already exist in playlist</p> <pre><code>&lt;div class="total-row"&gt; &lt;div class="total-title" src="music/04_LCR_Mae_Terra.mp3"&gt;04_LCR_Mae_Terra&lt;/div&gt; &lt;/div&gt; &lt;div class="total-row"&gt; &lt;div class="total-title" src="music/06LCR_Homem_Mal.mp3"&gt;06LCR_Homem_Mal&lt;/div&gt; &lt;/div&gt; &lt;div class="total-row"&gt; &lt;div class="total-title" src="music/06LCR_Homem_Mal.mp3"&gt;06LCR_Homem_Mal&lt;/div&gt; &lt;/div&gt; </code></pre> <p>and also i have the links to add the song in playlist</p> <pre><code>&lt;div id="playlinks"&gt; &lt;li mp3="music/04_LCR_Mae_Terra.mp3" class="add_link"&gt;&lt;/li&gt; &lt;li mp3="music/05_LCR_Jack_Matador.mp3" class="add_link"&gt;&lt;/li&gt; &lt;/div&gt; </code></pre> <p>so i will match the selected (clicked) link's mp3 link with already exists links in playlist (i will match with all rows), if that already exist then it does not add and if not exist then add the selected one. i am using the following jquery code</p> <pre><code>if i use the below code $(document).on("click", ".add_link", function(){ var mp3 = $(this).attr("mp3"); var foundInPlaylist = $(".total-row .total-title[src$='"+ ('/'+mp3) +"']").length; if(foundInPlaylist){ alert("found"); } else{ alert("not found"); } }); </code></pre> <p>this does not work, even if i just write alert(foundInPlaylist ); it alerts "0";</p> <pre><code>if i use the second solution $(".add_link").click(function () { var newMp3 = $(this).attr("mp3"); var exists = false; $(".total-row").each(function(){ var oldmp3 = $(this).children(".total-title").attr("src"); if(oldmp3.indexOf(newMp3) &gt; 0 ) { exists = true } }); if(exists) { alert("song already exists"); } else { alert("song does not exist"); } }); </code></pre> <p>it also does not work for me </p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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