Forum Discussion

Adagio's avatar
Frequent Contributor
4 years ago

Use addEventListener for keyboard action



I've to input some textvalue in a textbox using the addEventListner because other options are not working out.

var txtbxq =  pgx.contentDocument.getElementById('cxqInput');

txtbxq.addEventListener("122-123-2212", otherparamsifrequired);


Can someone please let me know if that can be done using the event listener?  


Thanks in advance!!


  • I got that working using the following. This is what I was looking for.

    This was very easy, but the autocomplete feature never suggested any such property. 

    var txtbxq =  pgx.contentDocument.getElementById('cxqInput');
    txtbxq.value = ValForPhn;

     I'd still be curious to know what the addEventListener() could have done this such case. 


    Thank you!

8 Replies

    • Adagio's avatar
      Frequent Contributor

       Hi Marsha_R , 


      I tried other functions such as Keys(), and SetText(). it doesn't support these functions. Probably because, I'm accessing the UI object using contentDocument. That's the reason I'm trying to explore other methods using which, I can set a text value in the textbox.


      Also, I'm doing it in Javascript, so any example that you have other than keyword, please suggest. 


      Thank you!

      • Marsha_R's avatar
        Champion Level 3

        Is there a particular reason you need to use contentDocument for this?