0

In one application of Xamarin I inserted an html page where I entered:

<Div class="item itemClick active">
    <Object class="image-responsive center-block" type="image / svg + xml" data="home_ic_report_menu.svg" date-command="commandFirst"></object>
    <Img data-command="commandFirst" src="vuota.png" class="menuitem" />
</ Div>
$.each(EnabledFeatures, function (e) { // cycling items
    divCarouselMenu.append('<div class="item itemClick"><object class="image-responsive center-block" type="image / svg + xml" data="home_ic_' + this.Icon + '.svg "date-command="' + this.ClickCommand + ' "style="z-index=0"></object><img data-command="' + this.ClickCommand + ' "src=" vuota.png "class=" menuitem "/></ div>');
});

based on the data that goes through the application and to click:

$(".menuitem").on('click', function() {
    var cmd = $(this).attr("data-command");
    Native('menuCommand', cmd);
});

in such a way that in the event there is the right operation.

Emulation (on the browser) funzionane fine, but when I start the application on the mobile (both ios that Android) the image you see, but do not click the event takes place. Something wrong? Because with the emulation works and then with the application does not work?

Many thanks to those who will respond to me.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Dave
  • 93
  • 1
  • 10
  • If your items are added after page load (and it surely looks like they are), change you code to: `$("document").on('click', ".menuitem", function() { ....` – Wesley Smith Mar 07 '16 at 13:44
  • Possible duplicate of [Event binding on dynamically created elements?](http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements) – Wesley Smith Mar 07 '16 at 13:45
  • Also, and maybe this is just me (it certainly is not the problem), your tags like `Div` and `Img` should either be all caps or all lowercase. Again this shouldnt cause any issues but it just looks wrong and to me is distracting. Could be just me though – Wesley Smith Mar 07 '16 at 13:47
  • What is `divCarouselMenu`? Where is it defined? – epascarello Mar 07 '16 at 13:57
  • Many thanks DelightedD0D! To capitalize is just a mistake on the copy and paste... divCarouselMenu is carousel of bootstrap – Dave Mar 07 '16 at 14:17

0 Answers0