2011-10-21 2 views
2

내 페이지의 <dd> 태그에 메모를 추가하려하지만 어떤 이유로 2 회 진행됩니다. 여기에 내가 추가 할 노력하고있어 <dd> 태그입니다 : 내가 사용 시도jQuery를 두 번 더 추가합니다.

<dd> 
    <input type="hidden" value="Choose a Country" class="FormFieldChoosePrefix"> 
    <input type="hidden" value="11" class="FormFieldId"> 
    <input type="hidden" value="2" class="FormFieldFormId"> 
    <input type="hidden" value="singleselect" class="FormFieldType"> 
    <input type="hidden" value="Country" class="FormFieldPrivateId"> 
     <select size="1" name="FormField[2][11]" id="FormField_11" style="" class="Field200 FormField"> 
      <option value="">Choose a Country</option>blah blah</select> 
-- want code to be added here -- 
</dd> 

는 다음

$('dd:contains("Choose a Country").append('whatever');

$('#FormField_11').parent().append('whatever');

$('#FormField_11').parent().first().append('whatever');

심지어

if ($('#FormField_11').parent().html().indexOf('whatever') == -1){ 
    $('#FormField_11').parent().append('whatever'); 
} 

모두 유용하지 않습니다. 매번 '무엇이든'이 두 번 나타나고 있습니다. 이상한 부분은 내가 페이지에서 나중에 다른 <dd> 태그에 같은 일을 할 수 있다는 점이며, 그것은 완벽하게 작동합니다 :

<dd> 
    <input type="hidden" value="Choose a Country" class="FormFieldChoosePrefix"> 
    <input type="hidden" value="21" class="FormFieldId"> 
    <input type="hidden" value="3" class="FormFieldFormId"> 
    <input type="hidden" value="singleselect" class="FormFieldType"> 
    <input type="hidden" value="Country" class="FormFieldPrivateId"> 
    <select size="1" name="FormField[3][21]" id="FormField_21" style="" class="Field200 FormField"> 
      <option value="">Choose a Country</option> 
      blah blah 
     </select> 
</dd> 

및 작동 내 자바 스크립트 :

$('#FormField_21').parent().append('whatever');

감사

+0

난 당신이'