title: How can I change the value of an Oracle APEX page item using JavaScript?
body: <p>I created the links in the left-most column to target a JavaScript function and I can successfully pass through the value of the row ID to that function.</p>
  
  <p><a href="https://i.stack.imgur.com/GR2xK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GR2xK.png" alt="enter image description here"></a></p>
  
  <p>Once clicked, a modal pops up to present a form to update the fields. However, I need the fields in the modal to be populated with the information from the row clicked. I figured I could create a hidden page item (P2_SONG_SELECT) to store the row ID so that I can use the value in my query for the data. My problem is I haven't been able to assign the row ID value to the application item.</p>
  
  <p>Here is my JavaScript:</p>
  
  <p>Each 'Edit' button successfully uses this URL target:</p>
  
  <pre><code>javascript:viewEditSong$(#Row_ID#).val();
  </code></pre>
  
  <p>to call this function:</p>
  
  <pre><code>function viewEditSong(Row_ID) {
    alert(Row_ID); // successfully alerts the Row ID
    $("#P2_SONG_SELECT").val() = UA_ID; // fails to assign
    $("#EditSongWindow").dialog('open'); // open the modal
  }
  </code></pre>
  
  <p><strong>How do I properly assign the page item the value passed in?</strong></p>
  
  <p>Elsewhere I use simliar syntax effectively:</p>
  
  <pre><code>ajaxRequest.add("P2_FILE_MAIN", $("#P2_FILE_MAIN").val()); // this works fine
  </code></pre>