Jquery 检索Div中的每个值

Jquery 检索Div中的每个值,jquery,Jquery,这段代码将循环几次 当任何用户选择任何单选按钮时,我希望找到所选的单选按钮 使用所选的索引,我希望获得address\uuobject。现在我想在一个变量中访问它的同级div值,比如addressLine_1、addressLine_2、addressLine_3、city、state、zip 请帮我写这段jQuery脚本 <div class="address"> <table width="100%" border="0" cellspacing="0" cellp

这段代码将循环几次

当任何用户选择任何单选按钮时,我希望找到所选的单选按钮

使用所选的索引,我希望获得
address\uuobject。现在我想在一个变量中访问它的同级div值,比如addressLine_1、addressLine_2、addressLine_3、city、state、zip

请帮我写这段jQuery脚本

<div class="address">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td width="8%" align="center"><input type="radio" name="addressSelected"  value="1" /></td>
        <td class="address_0" width="92%">
            <div class="addressLine_1">gotomedia LLC</div>
            <div class="addressLine_2">2169 FOLSOM ST</div>
            <div class="addressLine_3">STE M301</div>
            <div class="city floatLeft">SAN FRANCISCO</div>
            <div class="state floatLeft">&nbsp;CA</div>
            <div class="zip floatLeft">&nbsp;94110</div>
        </td>
    </tr>
    </table>
</div>

gotomedia有限责任公司
福尔松街2169号
STE M301
旧金山
加利福尼亚州
94110

我想这就是你的解决方案。 当此代码检查
$(this).val()=“1”
时,必须注意输入字段的值。也许你必须修改它

var values = [];
$("input[name=addressSelected]:checked")
  .filter( function () { return $(this).val() == "1"  } )
  .parent()           // the parent td
  .siblings()         // the other tds
  .children("div")    // the divs
  .each( function () { values.push ( $(this).text ) } );
这应该能奏效

您可以更改每行的名称:

 .each( function () { values[ this.className ] = $(this).text } );

因此,您可以像这样访问它:
values['addressLine_1']
但是为了获得好的结果,您必须删除浮点类

请添加更多代码,最好是包含您正在谈论的单选按钮的代码。因此,我们愿意帮助您完成家庭作业,但我们不会为您这样做。