mardi 5 mai 2015

jquery replace HTML div value

I am forming the div dynamically on document load like below. I have a ajax call and on response fro the ajax call i want replace the value 'right' with the value from the ajax call using jquery.

Basically i want to replace the value for the text div mentioned below once ajax has the success data.

            var beginContainer = '<div class="container">';
            var endDiv = '</div>';
            var beginInner = '<div class="inner">';
            var text = '<div class="text" id=3 style="color:#0000FF" align ="center">';
            var append = beginContainer + beginInner + text + 'Number of sensors' + endDiv + text + '10cents/sensor' + endDiv + endDiv + beginInner + text +'right'+endDiv +endDiv;
            $('#content').append(append);  
            var beginContainer = '<div class="container">';
            var endDiv = '</div>';
            var beginInner = '<div class="inner">';
            var text = '<div class="text" id=4 style="color:#0000FF" align ="center" value="kkk">';
            var append = beginContainer + beginInner + text + 'Total Bill' + endDiv + text + 'Month-to-Month' + endDiv + endDiv + beginInner + text +'right'+endDiv +endDiv;
            $('#content').append(append); 

Aucun commentaire:

Enregistrer un commentaire