jQuery(".single_writing").each(function(){
jQuery(this).click(function(){
jQuery("#thisTickets").val("");
jQuery("#my_iframe").contents().find('.ticket_id').each(function(){
jQuery(this).click(function(){
if (jQuery(this).attr("checked")==true){
jQuery("#thisTickets").val(jQuery("#thisTickets").val()+jQuery(this).attr("id")+", ");
}
});
});
})
});
Any ideas?
What I want to achieve is find out which checkboxes are checked in my iframe and I want to know their id’s, when I submit the form from my document (form in the main document, not the form in iframe)
Since jQuery is asynchronous language, the commands aren’t executed sequentially.
So, the problem in my code was, that it operated in the iframe, but with its previews value, before the clicking.
So I had to separate this code.
Now I have something like this and it works perfectly: