Clearing specific quill fields using a buttonjQuery get specific option tag textHow to insert an item into an array at a specific index (JavaScript)?How can I know which radio button is selected via jQuery?Submitting a form on 'Enter' with jQuery?Generating random whole numbers in JavaScript in a specific range?How to clear the canvas for redrawingSubmit form with Enter key without submit button?How to clear all input fields in a specific div with jQuery?Stale data with StimulusJS and Quill editorQuill Chrome Extension Youtube hotkeys

Is there a typical layout to blocking installed for backing in new construction framing?

Boss has banned cycling to work because he thinks it's unsafe

Show that there are infinitely more problems than we will ever be able to compute

PhD: When to quit and move on?

What is the difference between a historical drama and a period drama?

Who pays for increased security measures on flights to the US?

How can I define a very large matrix efficiently?

How do both sides know the MTU

Could you sell yourself into slavery in the USA?

Do intermediate subdomains need to exist?

Should I hide my travel history to the UK when I apply for an Australian visa?

Taking advantage when the HR forgets to communicate the rules

Bypass with wrong cvv of debit card and getting OTP

How to respond to someone who condemns behavior similar to what they exhibit?

What is the maximum amount of diamond in one Minecraft game?

Why do we need a bootloader separate than our application program in MCU's?

Why did moving the mouse cursor cause Windows 95 to run more quickly?

Does taking on an assistant professor position prevent me from doing post-docs later?

Sleepy tired vs physically tired

What is meant by perfect, imperfect consonance and dissonance?

Has there ever been a cold war other than between the U.S. and the U.S.S.R.?

What/Where usage English vs Japanese

Why does the Batman "crack his knuckles" in "Batman: Arkham Origins"?

Does Evolution Sage proliferate Blast Zone when played?



Clearing specific quill fields using a button


jQuery get specific option tag textHow to insert an item into an array at a specific index (JavaScript)?How can I know which radio button is selected via jQuery?Submitting a form on 'Enter' with jQuery?Generating random whole numbers in JavaScript in a specific range?How to clear the canvas for redrawingSubmit form with Enter key without submit button?How to clear all input fields in a specific div with jQuery?Stale data with StimulusJS and Quill editorQuill Chrome Extension Youtube hotkeys






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








0















I am using Quilljs 1.3.6. I want to add a button on an HTML form that will clear specific quilljs fields.



When I use jquery on any input text field, all I have to do is create a button that calls a javascript function, that deletes the content a field(s). For example:



HTML



<label for="strengths">How strong are you?<label>
<input type='text' name='strengths' id='strengths'>

<input type="button" onclick="clearTextField()">Clear Field</button>


Javascript File



function clearTextField() 
$('#strengths').val('');



How do I clear a quilljs field? I tried to do something like this:



HTML



<label for="strengths">How strong are you?<label>
<input type="hidden" name="strengths">
<div id="strengths-container">
<p>Blah Blah Blah</p>
</div>
<input type="button" onclick="clearTextField()">Clear Field</button>


Javascript File



function clearTextField() 
strengths.setContents([]);



However, this won't work, because the 'strengths' object was created in a different javascript function. And the scope of 'strengths' is limited to the function that instantiated it.



var strengths = new Quill("#strengths-container", 
modules:
toolbar: toolbaroptions
,
theme: "snow"
);


So, this Quilljs method not work.



function clearTextField() 
strengths.setContents([]);



I am trying to make the <div id="strengths-container'> clear the value:



<p>Blah Blah Blah</p>


I do not want to use an HTML reset button, because there are other form fields that I do not want to clear when clicking on the button to clear the Quilljs field(s).










share|improve this question






























    0















    I am using Quilljs 1.3.6. I want to add a button on an HTML form that will clear specific quilljs fields.



    When I use jquery on any input text field, all I have to do is create a button that calls a javascript function, that deletes the content a field(s). For example:



    HTML



    <label for="strengths">How strong are you?<label>
    <input type='text' name='strengths' id='strengths'>

    <input type="button" onclick="clearTextField()">Clear Field</button>


    Javascript File



    function clearTextField() 
    $('#strengths').val('');



    How do I clear a quilljs field? I tried to do something like this:



    HTML



    <label for="strengths">How strong are you?<label>
    <input type="hidden" name="strengths">
    <div id="strengths-container">
    <p>Blah Blah Blah</p>
    </div>
    <input type="button" onclick="clearTextField()">Clear Field</button>


    Javascript File



    function clearTextField() 
    strengths.setContents([]);



    However, this won't work, because the 'strengths' object was created in a different javascript function. And the scope of 'strengths' is limited to the function that instantiated it.



    var strengths = new Quill("#strengths-container", 
    modules:
    toolbar: toolbaroptions
    ,
    theme: "snow"
    );


    So, this Quilljs method not work.



    function clearTextField() 
    strengths.setContents([]);



    I am trying to make the <div id="strengths-container'> clear the value:



    <p>Blah Blah Blah</p>


    I do not want to use an HTML reset button, because there are other form fields that I do not want to clear when clicking on the button to clear the Quilljs field(s).










    share|improve this question


























      0












      0








      0








      I am using Quilljs 1.3.6. I want to add a button on an HTML form that will clear specific quilljs fields.



      When I use jquery on any input text field, all I have to do is create a button that calls a javascript function, that deletes the content a field(s). For example:



      HTML



      <label for="strengths">How strong are you?<label>
      <input type='text' name='strengths' id='strengths'>

      <input type="button" onclick="clearTextField()">Clear Field</button>


      Javascript File



      function clearTextField() 
      $('#strengths').val('');



      How do I clear a quilljs field? I tried to do something like this:



      HTML



      <label for="strengths">How strong are you?<label>
      <input type="hidden" name="strengths">
      <div id="strengths-container">
      <p>Blah Blah Blah</p>
      </div>
      <input type="button" onclick="clearTextField()">Clear Field</button>


      Javascript File



      function clearTextField() 
      strengths.setContents([]);



      However, this won't work, because the 'strengths' object was created in a different javascript function. And the scope of 'strengths' is limited to the function that instantiated it.



      var strengths = new Quill("#strengths-container", 
      modules:
      toolbar: toolbaroptions
      ,
      theme: "snow"
      );


      So, this Quilljs method not work.



      function clearTextField() 
      strengths.setContents([]);



      I am trying to make the <div id="strengths-container'> clear the value:



      <p>Blah Blah Blah</p>


      I do not want to use an HTML reset button, because there are other form fields that I do not want to clear when clicking on the button to clear the Quilljs field(s).










      share|improve this question
















      I am using Quilljs 1.3.6. I want to add a button on an HTML form that will clear specific quilljs fields.



      When I use jquery on any input text field, all I have to do is create a button that calls a javascript function, that deletes the content a field(s). For example:



      HTML



      <label for="strengths">How strong are you?<label>
      <input type='text' name='strengths' id='strengths'>

      <input type="button" onclick="clearTextField()">Clear Field</button>


      Javascript File



      function clearTextField() 
      $('#strengths').val('');



      How do I clear a quilljs field? I tried to do something like this:



      HTML



      <label for="strengths">How strong are you?<label>
      <input type="hidden" name="strengths">
      <div id="strengths-container">
      <p>Blah Blah Blah</p>
      </div>
      <input type="button" onclick="clearTextField()">Clear Field</button>


      Javascript File



      function clearTextField() 
      strengths.setContents([]);



      However, this won't work, because the 'strengths' object was created in a different javascript function. And the scope of 'strengths' is limited to the function that instantiated it.



      var strengths = new Quill("#strengths-container", 
      modules:
      toolbar: toolbaroptions
      ,
      theme: "snow"
      );


      So, this Quilljs method not work.



      function clearTextField() 
      strengths.setContents([]);



      I am trying to make the <div id="strengths-container'> clear the value:



      <p>Blah Blah Blah</p>


      I do not want to use an HTML reset button, because there are other form fields that I do not want to clear when clicking on the button to clear the Quilljs field(s).







      javascript jquery quill






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 10:41









      Flimzy

      42.9k13 gold badges71 silver badges108 bronze badges




      42.9k13 gold badges71 silver badges108 bronze badges










      asked Mar 25 at 18:38









      PhilPhil

      11 bronze badge




      11 bronze badge






















          0






          active

          oldest

          votes










          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/3.0/"u003ecc by-sa 3.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%2f55344450%2fclearing-specific-quill-fields-using-a-button%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using 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%2f55344450%2fclearing-specific-quill-fields-using-a-button%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