前CHAOSJQUERY:查找表单元素
我曾经有过这样的产品......
在头部
<script type="text/javascript">$(function() { $("form.openid:eq(0)").openid(); });</script>
在jquery.openid.js
var direct = function() {
var $li = $(this);
$this.unbind('submit').submit(function() {
$id.val($this.find("li.highlight span").text());
});
$this.submit();
return false;
};
并在身体部分
<form class="openid" method="post" action="/Login.xhtml?ReturnUrl=">
<div>
<ul class="providers">
<li class="direct" title="Google"> <img src="images/googleW.png" alt="icon" />
</ul>
</div>
</form>
它像一个魅力工作。
骚乱发生后,现在
,因为我想在ASP.NET页面我做出了相应的在母版
<script type="text/javascript">$(function() { $("#test.openidd").openid(); });</script>
头部改变
添加上述的所有内容
在身体的一部分,我加了id=test
的div和等于openidd
的等级。
<div id ="test" class="openidd">
<ul class="providers">
<li class="direct" title="Google"> <img src="images/google.png" />
</ul>
</div>
所以我应该做出什么样的变化对jquery.openid.js
,使其工作?
我的意思是在第一种情况下$this
指form.openid:eq(0)
在$this
指#text.openidd
第二种情况和形式从未提交。
我想像这样一个$this.FindParentForm
存在于JQUERY,但我不知道!
请保持您的回答尽可能简单,因为我是新手
预先感谢您。
UPDATE 从我迄今为止看到的答案来看,我想或者我没有清楚地设置我的问题,或者我是soooo新手。我添加了div标签作为元素的外壳。该表格包含其他<li>
的等jquery混乱。我不喜欢那样!这就是为什么在我的岗位我相信,这项工作已在jquery.openid.js
文件做...像
$this.GETParentFORM.unbind('submit').submit(function() {
$id.val($this.GETParentFORM.find("li.highlight span").text());
});
$this.GETParentFORM.submit();
我不明白什么功能,你叫这里$( “form.openid:EQ(0)”) .openid(),以及你在哪里调用函数var'direct = function(){...' – Aristos 2011-03-30 07:11:49
你为什么拼命t ry使用__this__?而不是使用__eq()__或者这样的事情,当你调用openid()时,你可能会尝试传递一个变量,也许像__。openid()__这样的相关表单的唯一ID,并且在openid函数中使用该id而不是__ $ this__ –
FallenAngel
2011-03-31 15:22:31
这会让你的父母的形式:http://carnotaurus.tumblr.com/post/3121098288/communication-between-frames-in-jquery – CarneyCode 2011-04-03 11:43:34