如何在Web视图控制器中引用下面的Jquery文件

时间:2013-05-22 16:41:43

标签: jquery ios objective-c

我有以下Jquery文件但不了解如何从我的Web视图控制器调用它。我正在寻找样本代码来做到这一点。任何帮助将不胜感激。

<!DOCTYPE html>
<html>
<head>
<style>span {display:none;}</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<p><input type="text" /> <span>focusin fire</span></p>
<p><input type="password" /> <span>focusin fire</span></p>
<script>
$("p").focusin(function() {
           $(this).find("span").css('display','inline').fadeOut(1000);
           });
</script>

</body>
</html>

1 个答案:

答案 0 :(得分:0)

看看stringByEvaluatingJavaScriptFromString 例如。 如果

<input id="password" type="password" />

,那么你可以

[self.webView stringByEvaluatingJavaScriptFromString:@"$('#password').fadeOut(1000);"];