Click function does not work on contact/requester field on Signup page in customer portal

Hi all,

I’m trying to hide specific choices from the default Language field on the Signup page for requesters for which I’m using the following code. The code does work after page is ready but once a Language choice is selected, if we click on the field again to select a different language, the fields are not hidden anymore.

To prevent this, I’m trying to use the click function in jQuery along with on(“click”, “id”, function(){}), etc but it does not work. Could someone please help?

jQuery("#userlanguage").click(function(){
   alert("Language field clicked");
});

Original code:

<script>
  jQuery(document).ready(function(){    
    //Hide the Requester Language dropdown choices - Start of code
    var choiceNumber=1;
    for(choiceNumber=1;choiceNumber<=43;choiceNumber++){
      jQuery("#choices--userlanguage-item-choice-"+choiceNumber+":not(:contains('English')):not(:contains('Norwegian')):not(:contains('Swedish')):not(:contains('German')):not(:contains('Danish')):not(:contains('Dutch'))").remove();                          
    }
    //Hide the Requester Language dropdown choices - End of code
  });
</script>```