UIWebView interacts with javascript. 1. uiwebview
I read two books last year and mentioned the interaction between UIWebView and javascript. However, I seldom submit specific operations. This year, I feel it is necessary to sort out this knowledge point.
First of all, you must reserve some simple javascript knowledge. I am reading this ebook javascript from entry to entry, and also have some basic html knowledge.
My main function is to load html files, operate the input boxes and buttons on html.
The code for test.html is as follows:
The code for test. js is as follows:
function check(){ var str = document.getElementById('input1').value alert(str);}
The OC code will not be posted here. I believe that you can do almost all the work on IOS. You can determine how to load html files in UIwebview.
Here we will share with you the running effect:
We can see that this is only a response to the events on the page, but for example, the content of the input is not implemented yet. We will share it with you in the next article.
Demo
I have just started my study here. I hope I can have more exchanges with you. It would be better if I could be a master. ^ _*