Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:27:12+00:00 2026-06-04T18:27:12+00:00

I have this function in jquery saved as doc2.js in my Target and i

  • 0

I have this function in jquery saved as doc2.js in my Target and i had copy in my bundle resources as follow:

doc2.js:

  $(document).ready(function(){
  $(".flip").click(function(){
  $(".panel").slideToggle("slow");
     });
       });

at my Xcode i have the following:

 UIWebView * webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"new" ofType:@"html"]isDirectory:NO]]];
 webView.delegate=self;
 [self.view addSubview:webView];

and this method :

-(void)webViewDidFinishLoad:(UIWebView *)webView {
 NSString *jqueryCDN = @"http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
 NSData *jquery = [NSData dataWithContentsOfURL:[NSURL URLWithString:jqueryCDN]];
 NSString *jqueryString = [[NSMutableString alloc] initWithData:jquery encoding:NSUTF8StringEncoding];
 [webView stringByEvaluatingJavaScriptFromString:jqueryString];
 NSString *filePath = [[NSBundle mainBundle] pathForResource:@"doc2" ofType:@"js" inDirectory:NO];
 NSData *fileData = [NSData dataWithContentsOfFile:filePath];
 NSString *jsString = [[NSMutableString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
 [webView stringByEvaluatingJavaScriptFromString:jsString];}

In my html file:

<!DOCTYPE html>
 <html>
    <head>        
         <script type="text/javascript" src="jquery.js"></script>
         <style type="text/css"> 
             div.panel,p.flip
            {
                 margin:0px;
                 padding:5px;
                 text-align:center;
                 background:#e5eecc;
                 border:solid 1px #c3c3c3;
             }
             div.panel
             {
                 height:120px;
                 display:none;
             }
             </style>
     </head>
     <body>    
         <div class="panel">
            <p>Any Thing.</p>
            <p>Any Thing.</p>
         </div>        
         <p class="flip">Show/Hide Panel</p>
            </body>
 </html>

this code should handle the UIWebView but its not working with me
I think that my jQuery function is not completed or something like that
Any idea ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:27:14+00:00Added an answer on June 4, 2026 at 6:27 pm

    You may want to try a different approach: Either include a local copy or download jquery from a cdn. Doing both seems unnecessary.

    Moreover: Just define a javascript function in your doc2.js, include the file in the HTML and call it directly within Cocoa. Make sure you exposed your functions to Cocoa with

    isSelectorExcludedFromWebScript
    

    Calling is possible with

    evaluateWebScript
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really quick jQuery question... I have this function: $(document).ready(function() { $('a#show1').click(function() { $('.item1').toggle(1000); return
I have this jQuery: $(document).ready(function() { $(#panel).hide(); $('.login').toggle( function() { $('#panel').animate({ height: 150, padding:20px
I have this toggleClass function: $(document).ready(function() { $(button#playersize).click(function(){ $(#wrapper).toggleClass(small large); $(.divone).toggleClass(small large); $(.divtwo).toggleClass(small large);
I have this function in jQuery that gets data from a page with POST,
I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
We have this anonymous function in our code, which is part of the jQuery's
Here's the story... I have a jQuery function that does something, this function is
I have this code in jquery : $(#order_btn).click(function(){ var totalprice = $(.price_amount).text(); $(#totalprice).val(totalprice); });
I have this jQuery validation control in my form. It's working: $(#webform-client-form-45).submit(function(){ if($(#edit-submitted-name-surname).val() ==
Right now I have this jQuery('.widget-prop').keyup(function() { var prop = jQuery(this).attr('id'); var val =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.