Firefox上的JQuery wrap方法问题

时间:2017-03-14 23:18:17

标签: javascript jquery google-chrome firefox

我对JQuery有点新鲜,但我似乎遇到了跨浏览器功能的挑战。我在表单的头部插入了以下代码:

<script>
$(document).ready(function(){

  /*wraps the action field in the Completed div with link to section*/
  $('input[id^="tfa_5660"]').val(function(i,origText) {
    $(this).wrap('<a href="' + origText + '">Review this section</a>');
    return "";
  });

  /*wraps the action field in the To-Do div with link to section*/
  $('input[id^="tfa_5714"]').val(function(i,origText) {
     $(this).wrap('<a href="' + origText + '">Start this section</a>');
     return "";
  }); 

});
</script>

jQuery功能适用于Chrome和Safari,但是当我在Firefox上测试它时,不是用输入值中的链接包装它,而是用页面本身的url包装输入。知道什么可能导致Firefox的问题,但不是Chrome或Safari?

请参阅下文,了解显示问题的屏幕截图

火狐: Screenshot of Firefox not working

下面是表单本身的HTML,由名为Form Assembly的WYSIWYG表单编辑器生成

<div class="htmlSection" id="tfa_5655"><div class="htmlContent" id="tfa_5655-HTML">Below is a list of the sections you've already completed.</div></div>
<table class="gridLayout ">
<thead><tr class="headerRow">
<th scope="col" id="tfa_5657[0]-GRID" class="">Section  </th>
<th scope="col" id="tfa_5658[0]-GRID" class=""><b>Description</b>       </th>
<th scope="col" id="tfa_5659[0]-GRID" class=""><b>Due Date</b>     </th>
<th scope="col" id="tfa_5660[0]-GRID" class=""><b>Action </b> </th>
<th scope="col" id="tfa_5661[0]-GRID" class=" wf-acl-hidden">Click here to name this section  </th>
</tr></thead>
<tbody>
<tr id="tfa_5656[0]" class="section repeat   alternate-0 " data-repeatlabel=" ">
<td class=""><div class="oneField field-container-D     " id="tfa_5657-D[0]"><div class="inputWrapper"><input type="text" id="tfa_5657[0]" name="tfa_5657[0]" value="Contact Information" placeholder="" default="Contact Information" readonly title="Section " class="readonly"></div></div></td>
<td class=""><div class="oneField field-container-D     " id="tfa_5658-D[0]"><div class="inputWrapper"><textarea id="tfa_5658[0]" name="tfa_5658[0]" readonly title="Description " class="readonly">Tell us about yourself</textarea></div></div></td>
<td class=""><div class="oneField field-container-D     " id="tfa_5659-D[0]"><div class="inputWrapper"><input type="text" id="tfa_5659[0]" name="tfa_5659[0]" value="" placeholder="" readonly title="Due Date " class="readonly"></div></div></td>
<td class=""><div class="oneField field-container-D     " id="tfa_5660-D[0]"><div class="inputWrapper"><input type="text" id="tfa_5660[0]" name="tfa_5660[0]" value="" placeholder="" readonly title="Action " class="formula=LinkReview+IDReview readonly"></div></div></td>
<td class=" wf-acl-hidden"><fieldset id="tfa_5661[0]" class="section wf-acl-hidden">
<legend id="tfa_5661[0]-L">Click here to name this section </legend>
<div class="oneField field-container-D     " id="tfa_5662-D[0]">
<label id="tfa_5662[0]-L" for="tfa_5662[0]" class="label preField "><b>ID</b>    </label><br><div class="inputWrapper"><input type="text" id="tfa_5662[0]" name="tfa_5662[0]" value="00To000001mtE3aEAE" placeholder="" default="00To000001mtE3aEAE" readonly title="ID " class="calc-IDReview readonly"></div>
</div>
<div class="oneField field-container-D     " id="tfa_5663-D[0]">
<label id="tfa_5663[0]-L" for="tfa_5663[0]" class="label preField "><b>Link</b>     </label><br><div class="inputWrapper"><input type="text" id="tfa_5663[0]" name="tfa_5663[0]" value="https://www.tfaforms.com/4605490?what_id=" placeholder="" default="https://www.tfaforms.com/4605490?what_id=" readonly title="Link " class="calc-LinkReview readonly"></div>
</div>

这是表单本身的链接,意识到我可能应该从头开始包含这个:https://www.tfaforms.com/4605382?contact_id=003o000000v6WOF

0 个答案:

没有答案