How to make this jquery work in UIWebView for iOS 5.1?

I have the following markup:

<div class="event-row-container">
    <div data-id="1" class="ios-location-name">Location Name</div>
    <div data-id="1" class="ios-location-detail" style="display: block;">
    700 S Grand Ave<br>
    Omaha<br>
    </div>
</div>

and the following jQuery:

$('.ios-location-name').click(function(){
  var event_id=$(this).data('id');
  alert('you clicked event_id:' + event_id);
  $('.ios-location-detail').toggle();
});

It works in all browsers, but not on the built-in UIWebView on iOS5.1 (simulator or device). Should this work? Is there something I am missing?

THX

change # 1 is there an EASY sun to make it work?

+3
source share
2 answers

As you already read, there are several problems that may be causing:

  • UIWebView does not log events clicknatively
  • Scripts are not needed (and apparently shouldn't) are full paths in their src / href.

So, for the second problem (found here ) try changing:

<script src="js/jquery-1.7.2.min.js"></script>

to

<script src="jquery-1.7.2.min.js"></script>

(, , ).

-, , : uiwebview?

. , : javascript UIWebView ObjectiveC

, PhoneGap , , , .

, Safari mobile, UIWebView, , / .

, , ... :

$('.ios-location-name').on("click", function(){

, - , click ( ). . , , .

+4

. .

enter image description here

0

All Articles