Note that there are some explanatory texts on larger screens.

plurals
  1. POSplit() not showing when index param is used
    text
    copied!<p>I have this:</p> <pre class="lang-js prettyprint-override"><code>$('li').click(function() { var currentSrc = $('img', this).attr('src').toString(); var grabAlt = $('img', this).attr('alt').split('|'); //alert(grabAlt[0]); $('.imgSample img').attr('src', currentSrc); $('.projectDescription').html('&lt;p class="projectDescription"&gt;' + grabAlt[0].join('&lt;/p&gt;')); $('.projectTitle').html(grabAlt[1]); }); </code></pre> <p>When I remove the [0] and [1] I can alert either and what I'm thinking is the first value [0], does replace the project description, but trying to place each in the respective place doesn't work at all.</p> <p>snippet of relevant html:</p> <pre><code>&lt;section class="workArea"&gt; &lt;div class="imgSample"&gt;&lt;img src="images/samples/testImage2.png" alt="This first part will be a short description. | this second part will be the title."&gt;&lt;/div&gt; &lt;p class="projectDescription"&gt;This is to be replaced when an image is clicked on.&lt;/p&gt; &lt;h3 class="projectTitle"&gt;To be replaced&lt;/h3&gt; &lt;/section&gt; &lt;/div&gt; &lt;nav&gt; &lt;ul class="print"&gt; &lt;li class="liRounded"&gt;&lt;img width="50" height="50" src="images/samples/image1.png" alt="Should replace the content in the paragraph. | Replace title copy."&gt;&lt;/li&gt; &lt;li class="liRounded"&gt;&lt;img width="50" height="50" src="images/samples/image2.png" alt="Second. | Replace title 2."&gt;&lt;/li&gt; &lt;li class="liRounded"&gt;&lt;img width="50" height="50" src="images/samples/image3.png" alt="third. | Replace title 3."&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; </code></pre> <p>Is it my syntax or usage that is wrong here?</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