hello everyone,
I am using this text-editor ,my query is that whatever the font style,color,head tag etc availabe in text-editor i chosse,how can i take all selected attributes in next page via hidden fields in form tag ???.
hello everyone,
I am using this text-editor ,my query is that whatever the font style,color,head tag etc availabe in text-editor i chosse,how can i take all selected attributes in next page via hidden fields in form tag ???.
— the simplest, most robust approach is to serialize what the editor actually contains and submit that, not try to re-derive every style on the receiving page. Serialize the editor HTML (innerHTML) into a hidden form field or textarea on submit, POST that to the server, sanitize it server-side, and render it on the next page together with the same stylesheet or equivalent CSS classes so fonts, colors and headings appear the same. This preserves exact markup (headings, spans, inline styles) and avoids brittle “inspect selection” logic.
A minimal workflow to copy the editor contents into a hidden field before submit:
<form id="theForm" method="post">
<input type="hidden" name="editor_html" id="editor_html">
<!-- editor area (provided by your editor) -->
</form>
<script>
document.getElementById('theForm').addEventListener('submit', function () {
document.getElementById('editor_html').value =
document.getElementById('editorArea').innerHTML;
});
</script> Notes, caveats and alternatives: if the editor uses CSS classes (not inline styles), also send the class names or ensure the receiving page includes the same stylesheet (this echoes ’s point). If the goal is to save toolbar UI state (current font dropdown, color picker) instead of content formatting, capture those control values on change and copy them into separate hidden inputs — but beware selections that span multiple style runs. Always sanitize incoming HTML (HTMLPurifier for PHP, DOMPurify or sanitize‑html for Node) before storing or echoing it to prevent XSS. For persistent user preferences (preferred font/color across sessions) consider saving to the user profile or localStorage rather than embedding into document HTML.
Finally, if using jQuery helpers like hinted at, the same submit-time copy can be done with jQuery; if Popline exposes an API hook, prefer that to polling DOM directly. ’s acknowledgement is on point — this pattern keeps the transport simple and reliable.
Jump to Post— shashikumar s g 15$("input[name*='nation']").css("background-color","yellow")
$("input[name*='nation']").css("background-color","yellow")
You could also build a css file and add it in with a link to that page in your editor
Thanks That was good idea.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.