JavaScript Manipulate a dynamically generated html element in jquery

I have a little problem here. ¿How i can manipulate a dynamically generated html, in Jquery?

I have a function like:

generatesomething : function(DestinationID,data){
    result = $.DoSomething(data)
    $('#'+Destinationid).html(data);
}

The script, in other point, receive through ajax an array. Naturally, I will iterate the array like:

$.each(response, function(key, value){
    ThisHtml = '<div id="div'+key'"></div>';
    $('#MyPlaceHolderDiv').html(ThisHTML)
    //In this point, i really need to call my first function
    $.generatesomething('div'+key',data)
    //But not works!!!!
}

How i can manipulated the generated div using my function?

Thanks in advance!

Edit: in a try to clarify my question, i will paste the exact functions.

I made this function. Please do not laugh at my code, I am newbie in jquery.

jQuery.fn.extend({ /funciones Generales/

piegraph : function(GraficoDestino,tipo,arrayDatos,dato1,dato2,tooltiptemplate,labeltemplate){
    var dataPoints = [];
    $.each(arrayDatos, function(key, value){
        var temporal = {};
        temporal.label = value[dato1];
        temporal.y = parseInt(value[dato2]);
        dataPoints.push(temporal);
    });
    var opciones = {

        animationEnabled : true,
        data : [{
            type : tipo,
            startAngle : 0,
            toolTipContent : tooltiptemplate,
            indexLabel : labeltemplate,
            dataPoints : dataPoints,
        }]

    };
    $('#' + GraficoDestino).CanvasJSChart(opciones);
}

This function works pretty well... if i can give it the destination div to it.

In other part of my script, i have a ajax call:

Generadisco: function(){
    var datos = {
        "accion":"generadisco"
    };
    $.ajax({   
        type: "POST",
        url: "blahblah.php",
        data: datos,
        dataType: "json",
        success:function(response){

            $.each(response, function(key, value){
                esteHTML = '<div id="divdisco'+key+'"></div>                    
                $('#discosplace').append(estehtml);
                //the div is generated... but when i do...:
                $(this).piegraph('divdisco'+key,'pie', response[3],0,1, "{label} #percent%","{label} ");
                //nothing happens
            });
        }
    });
}
Answer:1

I found some error in your code:

$('#MyPlaceHolderDiv').html(ThisHTML)
$.generatesomething('div'+ key ,data)

must to be:

$('#MyPlaceHolderDiv').html(ThisHTML);
$.generatesomething('div'+key',data);

Also try to add console.log(DestinationID) in first line of your function to see passed argument (DestinationID)

Answer:2

How can I make a partial string match in Javascript? e.g. to match 'Alf' 'Alfred' -> true 'Alf' -> true 'alf' -> true 'al' -> true 'altered' -> false 'half' -> false '' -> false 'bob' -> false ...

How can I make a partial string match in Javascript? e.g. to match 'Alf' 'Alfred' -> true 'Alf' -> true 'alf' -> true 'al' -> true 'altered' -> false 'half' -> false '' -> false 'bob' -> false ...

  1. javascript matching strings
  2. js matching strings
  3. javascript compare strings
  4. javascript compare strings ignore case
  5. javascript compare strings equal
  6. javascript compare strings alphabetically
  7. javascript compare strings case insensitive
  8. javascript compare strings sort
  9. javascript compare strings as numbers
  10. javascript compare strings lexicographically
  11. javascript compare strings not equal
  12. javascript compare strings ignore whitespace
  13. javascript compare strings alphabetical order
  14. javascript compare strings contains
  15. javascript compare strings greater than
  16. javascript compare strings without case sensitive
  17. javascript compare strings like
  18. javascript compare strings and find difference
  19. javascript compare strings in array
  20. javascript compare strings with special characters

When I try browser.ExecuteJavascript("alert('ExecuteJavaScript works!');") it works fine (pops up a alert when the browser is created). When I try browser.ExecuteJavascript("document.getElementsByName(...

When I try browser.ExecuteJavascript("alert('ExecuteJavaScript works!');") it works fine (pops up a alert when the browser is created). When I try browser.ExecuteJavascript("document.getElementsByName(...

We have a chatting website and we disabled the Copy-Paste function to prevent spammers. But now they have found a new way to use auto typing software to spam. Is there any way to detect human typing ...

We have a chatting website and we disabled the Copy-Paste function to prevent spammers. But now they have found a new way to use auto typing software to spam. Is there any way to detect human typing ...

I'm reading the documentation on Vue.extend: Create a “subclass” of the base Vue constructor. The argument should be an object containing component options. What does 'subclass' mean in Vue.js?

I'm reading the documentation on Vue.extend: Create a “subclass” of the base Vue constructor. The argument should be an object containing component options. What does 'subclass' mean in Vue.js?

  1. what does ���� mean
  2. what does smh mean
  3. what does boomer mean
  4. what does ok boomer mean
  5. what does the fox say
  6. what does simp mean
  7. what does sos mean
  8. what does dna stand for
  9. what does noel mean
  10. what does asl mean
  11. what does ig mean
  12. what does gap stand for
  13. what does otp mean
  14. what does uwu mean
  15. what does mean
  16. what does goat mean
  17. what does bomboclaat mean
  18. what does pansexual mean
  19. what does woke mean
  20. what does ion mean