I am forming the div dynamically on document load like below. I have a ajax call and on response fro the AJAXcall I want to 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);
AJAXcall?spanand give this element anID. So you can refer to it by itsIDlater.id=3intextvariable's div, and in theappendvariable, you are usingtextmultiple times. This will create multiple elements with the same id, which is not proper HTML and is considered a very bad practice. I think you should consider fixing this and perhaps refactor the code to make it easier to spot before working on the AJAX or you'll be in for a lot more headache down the line.divelement doesn't have an attributevalue. Also, the use of the attributealignis deprecated.