Using jQuery selectors to find all ids that end a certain way
<p>I am adding a row using the clone() function and then am having to rename all of the divs in the newly cloned row. I was trying to do that this way:</p>

<pre>
// Add button for new TOEFL entry
        $("#add-TOEFL").button().click(function( event ){
                event.preventDefault();

                var tag = 'TOEFL',
                    testDate = $("#TOEFLtestDate-0").val(),
                    reading = $("#readingTOEFLScore-0").val(),
                    listening = $("#listeningTOEFLScore-0").val(),
                    speaking = $("#speakingTOEFLScore-0").val(),
                    writing = $("#writingTOEFLScore-0").val(),
                    applicantId = $("#applicantId").val(),
                    dataString = 'applicantId=' + applicantId + '&dateTaken=' + testDate + '&listeningScore=' + listening + '&readingScore=' + reading + '&speakingScore=' + speaking + '&writingScore=' + writing;

                // Insert New Record
                $.ajax({
                    type: "POST",
                    url: "ajax/insertEntry.cfm?xAction=TOEFL",
                    data: dataString,
                    success: function(newIdx){

                        // Make sure returned value is a number
                        newId = jQuery.trim(newIdx) * 1;

                        // clone new row
                        newDivId = tag + '-Entry-' + newId;
                        newRow = $('#' + tag + '-Entry-0').clone().attr('id', newDivId);
                        console.log('New row cloned. DivId: ' + newDivId);

                        // get all ids
                        $("#" + newDivId).find("[@id$='-0']").each(function(){
                            selectedDivId = $(this).attr("id");
                            alert(selectedDivId);   
                        })  

                    }
                })

</pre>

<p>Here is the HTML markup:</p>

<pre><code>&lt;div id="TOEFL-Entry-0" style="display: none" &gt;          
        &lt;p style="margin:5px 0 0 0"&gt;
            Taken  &lt;input name="TOEFLtestDate-0" type="text" id="TOEFLtestDate-0" class="inputDateField" style="margin-left:5px; margin-right:15px;"/&gt;
            Reading &lt;input name="readingTOEFLScore-0" type="text" id="readingTOEFLScore-0" class="inputTinyScoreField" style="margin:0 8px 0 5px"/&gt;
            Listening &lt;input name="listeningTOEFLScore-0" type="text" id="listeningTOEFLScore-0" class="inputTinyScoreField" style="margin:0 8px 0 5px"/&gt;
            Speaking &lt;input name="speakingTOEFLScore-0" type="text" id="speakingTOEFLScore-0" class="inputTinyScoreField" style="margin:0 8px 0 5px"/&gt;
            Writing &lt;input name="writingTOEFLScore-0" type="text" id="writingTOEFLScore-0" class="inputTinyScoreField" style="margin:0 8px 0 5px"/&gt;
            &lt;button id="add-TOEFL-0"&gt;Add&lt;/button&gt;
        &lt;/p&gt;
    &lt;/form&gt;
&lt;/div&gt;
</code></pre>

<p>Even thought there should be a bunch of ids that match this criteria, I am not seeing the alert.</p>

<p>What am I doing wrong?</p>

<p>Josh</p>
