0

The checkbox created in MS Sharepoint form has this html structure;

<div class="fd_field " fd_name="purchase_order" style="">
  <div class="fd_title" style="width: 150px;">purchase_order</div>
  <div class="ms-formbody fd_control" fd_type="MultiChoice">
    <span dir="none">
      <table cellspacing="1" cellpadding="0">				
        <tbody>
          <tr>
            <td><span class="ms-RadioText" title="Carica dati">
              <input id="ctl00_ctl40_g_2bbe8d3f_1b61_4103_9ca6_2e943eb28860_purchase_orderField_ctl00_ctl00" type="checkbox" name="ctl00$ctl40$g_2bbe8d3f_1b61_4103_9ca6_2e943eb28860$purchase_orderField$ctl00$ctl00">
              <label for="ctl00_ctl40_g_2bbe8d3f_1b61_4103_9ca6_2e943eb28860_purchase_orderField_ctl00_ctl00">Carica dati</label></span>
            </td>
        </tr>
      </tbody>
    </table>
    </span>
  </div>
</div>

with ajax i got other data that i want to add as option in that checkbox. The loop to retrieve data is not a problem but, how can i append those data in a new row of the checkbox? In the past i was able to edit dropdown field but it not works with checkbox.

I was thinking to the a solution like this:

var f = '<tr><td><input type="checkbox" name="xxx" id="ss"><label for="ss">Other</label></td></tr>';
$( ".ms-RadioText" ).parent().append(f);

Thanks

1 Answer 1

1

You mean this?

PS: I would not expect a table in a span !

var f = '<tr><td><span class="ms-RadioText" title="XXX"><input id="ss" type="checkbox" name="xx"><label for="ss">Other</label></span></td>';
$(".ms-RadioText").closest("tbody").append(f);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="fd_field " fd_name="purchase_order" style="">
  <div class="fd_title" style="width: 150px;">purchase_order</div>
  <div class="ms-formbody fd_control" fd_type="MultiChoice">
    <span dir="none">
      <table cellspacing="1" cellpadding="0">				
        <tbody>
          <tr>
            <td><span class="ms-RadioText" title="Carica dati"><input id="xx" type="checkbox" name="xx"><label for="xx">Carica dati</label></span></td>
        </tr>
      </tbody>
    </table>
    </span>
  </div>
</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.