none
IE extensions related javascript issue RRS feed

  • Question

  • Hi,

      I have created one IE extension which contains toolbar button, onclick of this toolbar button click I have to create one button element in DOM and onclick of that element I have to trigger some javascript functions and ultimately need to consume some REST APIs.

     It works fine till calling Tab button onclick function and even button element is getting appended correctly on DOM, but problem is onclick event of that added button element does not get triggered. Here is my code snippet inside tool bar button click:-

     function OnToolbarButtonClick() {
            try {

                //Create an input type dynamically.
                var type = 'button';
                var element = external.menuArguments.document.createElement("input");
                var oWindow = window.external.menuArguments;
                  
                //Assign different attributes to the element.
                element.setAttribute("type", type);
                element.setAttribute("value", type);
                element.setAttribute("name", type);
                element.setAttribute("onclick", "testFun();"); //even simple alert() or oWindow .alert() doesnt work
                external.menuArguments.document.body.appendChild(element);
          

            }
            catch (ex) {
                debugger;
            }
        }

        function testFun() {
            alert();
        }


        OnToolbarButtonClick();

    Any help or reference is appreciated.

    Thanks and regards,

    Arvind

    (arvind.chamoli2006@gmail.com)


    arvind chamoli

    Friday, October 31, 2014 11:43 AM

All replies

  • Hi arvind chamoli

    This is not the right place to discuss this issue, please post this issue in the following forum

    Internet Explorer Extension Forum

    https://social.msdn.microsoft.com/Forums/ie/en-US/home?forum=ieextensiondevelopment

    Members there are more familiar with this kind of problem, they have rich resource and experience and can better help you.

    Thanks for your support.

    Regards


    Yolanda Zhu
    TechNet Community Support

    Monday, November 3, 2014 2:26 AM
    Moderator
  • Hi,

    Press your custom toolbar (Command bar) button... then use the Find tool of the Developer tool to display the computed markup.

    or

    Select the Debug tab of developer tools and then press your Command bar button.

    Include any error messages when posting to the IE Extension development forum.

    You should see "OnToolbarButtonClick is undefined."


    Rob^_^

    Monday, November 3, 2014 3:03 AM