Make a function only run once (Javascript)
<p>So I'm trying to create a function which changes the 0 slot of an array to an input value. However I want this function to only be able to run once. How do I do this, any help is greatly appreciated thanks.</p>

<pre><code>function submitForm() {
    $('#inputForm').submit;
         if ($("#inputValue").val() != inputException) {
              charSetName();
              $("#inputValue").val("");
         }
         $("#inputValue").val("");
     }
function charSetName() {
    var nameSet = false;
    if (nameSet == false) {
        nameSet = true;
        charDetails[0] = $("#inputValue").val();
        document.getElementById("name").innerHTML = "&lt;li id='name''&gt;Name: " + charDetails[0] + "&lt;/li&gt;";
    }
}
</code></pre>