I have

<div aura:id="form">
    <lightning:input type="text" placeholder="???" label="x" variant="label-hidden" name="x" aura:id="x" />

<lightning:button variant="brand" label="Submit" onclick="{! c.handleClick }" /> 

in controller:

handleClick : function(component, event, helper) {
    var body = component.find("form");

Is it possible to get html code of the div with input and its value?

What I want is to get a String with html code to render it in aura:unescapedHtml and then use it further with entered value. This is only a sample code, the component is much more complex with many fields (inputs and checkboxes)

  • You cannot access the DOM elements of component belonging to foreign namespace. If you can provide us enough information on what needs to be done, we can help you better. – Praveen Dec 20 '17 at 7:00
  • what I want to achieve is to have a component with table. User should fill in this table with values and then click a button which should grab html code of this component and put it to variable. Then I need to work with the html code outside lightning component, like rendering pdf file, ... – Karel L Dec 20 '17 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.