radio button not showing the selected value in litelement componentChange the selected value of a drop-down list with jQueryHow can I know which radio button is selected via jQuery?How can I get query string values in JavaScript?Get selected value in dropdown list using JavaScriptHow to uncheck a radio button?How to check a radio button with jQuery?Copy array by valueOnChange event handler for radio button (INPUT type=“radio”) doesn't work as one valueShow form based on radio button selectRadio button onclick to update form

Why would an airport be depicted with symbology for runways longer than 8,069 feet even though it is reported on the sectional as 7,200 feet?

What's the biggest difference between these two photos?

Why does PAUSE key have a long make code and no break code?

When did computers stop checking memory on boot?

What is the delta-v required to get a mass in Earth orbit into the sun using a SINGLE transfer?

Friend is very nitpicky about side comments I don't intend to be taken too seriously

Is there a "right" way to interpret a novel, if not, how do we make sure our novel is interpreted correctly?

If every star in the universe except the Sun were destroyed, would we die?

Can you pop microwave popcorn on a stove?

I won a car in a poker game. How is that taxed in Canada?

How should Thaumaturgy's "three times as loud as normal" be interpreted?

What exactly is Apple Cider

Why is it that I have to play this note on the piano as A sharp?

Was Robin Hood's point of view ethically sound?

I multiply the source, you (probably) multiply the output!

Is a MySQL database a viable alternative to LDAP?

Why did Tony's Arc Reactor do this?

Leaving the USA for 10 yrs when you have asylum

Did "Dirty Harry" feel lucky?

Contour plot of a sequence of spheres with increasing radius

How to run NPCs with complicated mechanics?

Is Sanskrit really the mother of all languages?

Would scoring well on a non-required GRE Mathematics Subject Test make me more competitive?

Compiler optimization of bitwise not operation



radio button not showing the selected value in litelement component


Change the selected value of a drop-down list with jQueryHow can I know which radio button is selected via jQuery?How can I get query string values in JavaScript?Get selected value in dropdown list using JavaScriptHow to uncheck a radio button?How to check a radio button with jQuery?Copy array by valueOnChange event handler for radio button (INPUT type=“radio”) doesn't work as one valueShow form based on radio button selectRadio button onclick to update form






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am newbie to litelement, I have a lit-element component in which radio click event function on rendering gives undefined.I want to display the selected radio button value in render method as well to the corresponding provider id.



render() 
return html`
$this.provider.map(function (provider)
return html`
<div class="card">
<p>$provider.name</p>
<div class="form-group">
<div class="form-check pb-2" @click=$this.handleSending>
<input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
<label>
Bank Transfer
</label><br>
<input class="form-check-input" type="radio" name="sending" value="Credit Card">
<label>
Credit Card
</label><br>
</div>
</div>
</div>`;
)
`;



import LitElement, html, css from 'https://unpkg.com/@polymer/lit-element/lit-element.js?module';
export class Provider extends LitElement
constructor()
super();
this.provider=[

id="1", name="fund" ,description: "Raising Funds"
,

id="2", name="transfer" ,description: "transfering money"

];

handleSending()
var selected_sendoption = this.shadowRoot.querySelector('input[name = "sending"]:checked').value;

render()
return html`
$this.provider.map(function (provider)
return html`
<div class="card">
<p>$provider.name</p>
<div class="form-group">
<div class="form-check pb-2" @click=$this.handleSending>
<input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
<label>
Bank Transfer
</label><br>
<input class="form-check-input" type="radio" name="sending" value="Credit Card">
<label>
Credit Card
</label><br>
</div>
</div>
</div>`;
)
`;




Expected Result,
show the radio button selected value in render html










share|improve this question
































    0















    I am newbie to litelement, I have a lit-element component in which radio click event function on rendering gives undefined.I want to display the selected radio button value in render method as well to the corresponding provider id.



    render() 
    return html`
    $this.provider.map(function (provider)
    return html`
    <div class="card">
    <p>$provider.name</p>
    <div class="form-group">
    <div class="form-check pb-2" @click=$this.handleSending>
    <input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
    <label>
    Bank Transfer
    </label><br>
    <input class="form-check-input" type="radio" name="sending" value="Credit Card">
    <label>
    Credit Card
    </label><br>
    </div>
    </div>
    </div>`;
    )
    `;



    import LitElement, html, css from 'https://unpkg.com/@polymer/lit-element/lit-element.js?module';
    export class Provider extends LitElement
    constructor()
    super();
    this.provider=[

    id="1", name="fund" ,description: "Raising Funds"
    ,

    id="2", name="transfer" ,description: "transfering money"

    ];

    handleSending()
    var selected_sendoption = this.shadowRoot.querySelector('input[name = "sending"]:checked').value;

    render()
    return html`
    $this.provider.map(function (provider)
    return html`
    <div class="card">
    <p>$provider.name</p>
    <div class="form-group">
    <div class="form-check pb-2" @click=$this.handleSending>
    <input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
    <label>
    Bank Transfer
    </label><br>
    <input class="form-check-input" type="radio" name="sending" value="Credit Card">
    <label>
    Credit Card
    </label><br>
    </div>
    </div>
    </div>`;
    )
    `;




    Expected Result,
    show the radio button selected value in render html










    share|improve this question




























      0












      0








      0








      I am newbie to litelement, I have a lit-element component in which radio click event function on rendering gives undefined.I want to display the selected radio button value in render method as well to the corresponding provider id.



      render() 
      return html`
      $this.provider.map(function (provider)
      return html`
      <div class="card">
      <p>$provider.name</p>
      <div class="form-group">
      <div class="form-check pb-2" @click=$this.handleSending>
      <input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
      <label>
      Bank Transfer
      </label><br>
      <input class="form-check-input" type="radio" name="sending" value="Credit Card">
      <label>
      Credit Card
      </label><br>
      </div>
      </div>
      </div>`;
      )
      `;



      import LitElement, html, css from 'https://unpkg.com/@polymer/lit-element/lit-element.js?module';
      export class Provider extends LitElement
      constructor()
      super();
      this.provider=[

      id="1", name="fund" ,description: "Raising Funds"
      ,

      id="2", name="transfer" ,description: "transfering money"

      ];

      handleSending()
      var selected_sendoption = this.shadowRoot.querySelector('input[name = "sending"]:checked').value;

      render()
      return html`
      $this.provider.map(function (provider)
      return html`
      <div class="card">
      <p>$provider.name</p>
      <div class="form-group">
      <div class="form-check pb-2" @click=$this.handleSending>
      <input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
      <label>
      Bank Transfer
      </label><br>
      <input class="form-check-input" type="radio" name="sending" value="Credit Card">
      <label>
      Credit Card
      </label><br>
      </div>
      </div>
      </div>`;
      )
      `;




      Expected Result,
      show the radio button selected value in render html










      share|improve this question
















      I am newbie to litelement, I have a lit-element component in which radio click event function on rendering gives undefined.I want to display the selected radio button value in render method as well to the corresponding provider id.



      render() 
      return html`
      $this.provider.map(function (provider)
      return html`
      <div class="card">
      <p>$provider.name</p>
      <div class="form-group">
      <div class="form-check pb-2" @click=$this.handleSending>
      <input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
      <label>
      Bank Transfer
      </label><br>
      <input class="form-check-input" type="radio" name="sending" value="Credit Card">
      <label>
      Credit Card
      </label><br>
      </div>
      </div>
      </div>`;
      )
      `;



      import LitElement, html, css from 'https://unpkg.com/@polymer/lit-element/lit-element.js?module';
      export class Provider extends LitElement
      constructor()
      super();
      this.provider=[

      id="1", name="fund" ,description: "Raising Funds"
      ,

      id="2", name="transfer" ,description: "transfering money"

      ];

      handleSending()
      var selected_sendoption = this.shadowRoot.querySelector('input[name = "sending"]:checked').value;

      render()
      return html`
      $this.provider.map(function (provider)
      return html`
      <div class="card">
      <p>$provider.name</p>
      <div class="form-group">
      <div class="form-check pb-2" @click=$this.handleSending>
      <input class="form-check-input" type="radio" name="sending" value="Bank Transfer">
      <label>
      Bank Transfer
      </label><br>
      <input class="form-check-input" type="radio" name="sending" value="Credit Card">
      <label>
      Credit Card
      </label><br>
      </div>
      </div>
      </div>`;
      )
      `;




      Expected Result,
      show the radio button selected value in render html







      javascript web-component lit-element lit-html






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 8:03







      Senthil

















      asked Mar 28 at 6:28









      SenthilSenthil

      3329 bronze badges




      3329 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          You may simply need to bind the event handler to the element in question, and you also need to wrap your event handler in quotes just like any other HTML attribute:



          <div class="form-check pb-2" @click="$this.handleSending.bind(this)">


          You also may want to remove the spaces in your selector - the selector may work, but I've personally never seen selectors with spaces in them like that.



          edit: The problem may also be with the fact that you're nesting function calls, so the value of this might be different than you expect. You can add a line like this at the top of your render method: const context = this;, and then replace all references to this with context in the remainder of the template.






          share|improve this answer


























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391377%2fradio-button-not-showing-the-selected-value-in-litelement-component%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            You may simply need to bind the event handler to the element in question, and you also need to wrap your event handler in quotes just like any other HTML attribute:



            <div class="form-check pb-2" @click="$this.handleSending.bind(this)">


            You also may want to remove the spaces in your selector - the selector may work, but I've personally never seen selectors with spaces in them like that.



            edit: The problem may also be with the fact that you're nesting function calls, so the value of this might be different than you expect. You can add a line like this at the top of your render method: const context = this;, and then replace all references to this with context in the remainder of the template.






            share|improve this answer































              0
















              You may simply need to bind the event handler to the element in question, and you also need to wrap your event handler in quotes just like any other HTML attribute:



              <div class="form-check pb-2" @click="$this.handleSending.bind(this)">


              You also may want to remove the spaces in your selector - the selector may work, but I've personally never seen selectors with spaces in them like that.



              edit: The problem may also be with the fact that you're nesting function calls, so the value of this might be different than you expect. You can add a line like this at the top of your render method: const context = this;, and then replace all references to this with context in the remainder of the template.






              share|improve this answer





























                0














                0










                0









                You may simply need to bind the event handler to the element in question, and you also need to wrap your event handler in quotes just like any other HTML attribute:



                <div class="form-check pb-2" @click="$this.handleSending.bind(this)">


                You also may want to remove the spaces in your selector - the selector may work, but I've personally never seen selectors with spaces in them like that.



                edit: The problem may also be with the fact that you're nesting function calls, so the value of this might be different than you expect. You can add a line like this at the top of your render method: const context = this;, and then replace all references to this with context in the remainder of the template.






                share|improve this answer















                You may simply need to bind the event handler to the element in question, and you also need to wrap your event handler in quotes just like any other HTML attribute:



                <div class="form-check pb-2" @click="$this.handleSending.bind(this)">


                You also may want to remove the spaces in your selector - the selector may work, but I've personally never seen selectors with spaces in them like that.



                edit: The problem may also be with the fact that you're nesting function calls, so the value of this might be different than you expect. You can add a line like this at the top of your render method: const context = this;, and then replace all references to this with context in the remainder of the template.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 13 at 16:44

























                answered May 13 at 15:46









                IsochronousIsochronous

                8988 silver badges20 bronze badges




                8988 silver badges20 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391377%2fradio-button-not-showing-the-selected-value-in-litelement-component%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript