0

I want to call a function by creating a html table. The function I want to call is called setHooks. more precisely this time I want to call the function (setHooks) if my table parts was added so the function can check if the checkbox needs a hook HTML

'<td><form action=""><div class="myClass"><label><input type="checkbox" name="box'+index+'" '+setHooks('daten.identification','MyBox'+pageForBoxes+''+index) id="MyBox'+pageForBoxes+''+index+'" value="'+daten.identification+'" > Anzeigen</label></div></form></td></tr>');

thats what I tried but it won't work can u help me please ?

JS

` function setHooks(id,myBox){

if(boxArr.indexof(id) != -1){
    $(myBox).attr('checked', true)
}


}`
4
  • what are you trying to do? Commented Jul 1, 2015 at 11:24
  • 1
    What do you mean by I want to call a function by creating a html table. Commented Jul 1, 2015 at 11:24
  • so when the row was added to the table it I want it to call the function so it can check if the checkbox need to get a hook Commented Jul 1, 2015 at 11:26
  • Could you please add your JS code? Commented Jul 1, 2015 at 11:27

1 Answer 1

1

See the script tag at the end of td:

<td>
    <form action="">
        <div class="myClass">
            <label>
                <input type="checkbox" id="MyBox'+pageForBoxes+ ''+index+ '" value="'+daten.identification+ '"> Anzeigen
                </label>
        </div>
    </form>
    <script>
        setHooks('daten.identification','MyBox' + pageForBoxes + '' + index); // Call it here
    </script>
</td>
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.