I have two Content Editor Webparts in a page(CEWP) in a SharePoint page. In the first CEWP I have two html text boxes and one button. If i click on the button in first CEWP the second CEWP will display the result in page. How to concatenate and display the result.
2 Answers
Its not needed to use two CEWP, you can achieve it in a single CEWP itself. After your html textbox and buttons add a 'div' tag as below.
<div id="displayresults" />
On click event of your button, call a JavaScript function that will your results to the div like below,
var resultdiv = $("#displayresults");
var resultTable="<Your results in html format>";
$(resultTable).appendTo(resultdiv);
You should use ID in the HTML elements.
Example
first content editor
<input type="button" onclick="SetSecondC();" values="Click" />
function SetSecondC() {
document.getElementById('txtSecond').value = "Message";
}
second content editor
<input type="text" id="txtSecond" />