Property id is not defined in type Node in PhpStorm/WebStormDetecting an undefined object propertyHow can I merge properties of two JavaScript objects dynamically?How do I remove a property from a JavaScript object?What is the preferred syntax for defining enums in JavaScript?Sort array of objects by string property valueRemove all child elements of a DOM node in JavaScriptJavaScript check if variable exists (is defined/initialized)Iterate through object propertiesCan IntelliJ IDEA encapsulate all of the functionality of WebStorm and PHPStorm through plugins?Difference between WebStorm and PHPStorm

Bash method for viewing beginning and end of file

Can criminal fraud exist without damages?

Efficiently merge handle parallel feature branches in SFDX

Can a monster with multiattack use this ability if they are missing a limb?

Why are on-board computers allowed to change controls without notifying the pilots?

Will it be accepted, if there is no ''Main Character" stereotype?

Generic lambda vs generic function give different behaviour

Failed to fetch jessie backports repository

The baby cries all morning

Using parameter substitution on a Bash array

Is a roofing delivery truck likely to crack my driveway slab?

Products and sum of cubes in Fibonacci

How does a character multiclassing into warlock get a focus?

Trouble understanding overseas colleagues

What are the ramifications of creating a homebrew world without an Astral Plane?

Curses work by shouting - How to avoid collateral damage?

when is out of tune ok?

Greatest common substring

What is the oldest known work of fiction?

How could Frankenstein get the parts for his _second_ creature?

Everything Bob says is false. How does he get people to trust him?

Is there an Impartial Brexit Deal comparison site?

Should my PhD thesis be submitted under my legal name?

There is only s̶i̶x̶t̶y one place he can be



Property id is not defined in type Node in PhpStorm/WebStorm


Detecting an undefined object propertyHow can I merge properties of two JavaScript objects dynamically?How do I remove a property from a JavaScript object?What is the preferred syntax for defining enums in JavaScript?Sort array of objects by string property valueRemove all child elements of a DOM node in JavaScriptJavaScript check if variable exists (is defined/initialized)Iterate through object propertiesCan IntelliJ IDEA encapsulate all of the functionality of WebStorm and PHPStorm through plugins?Difference between WebStorm and PHPStorm













0















Php/WebStorm is reporting this wierd warning in my JavaScript code stating that property id is not defined in the element/node. Thing is, the element is a firstChild element fetched from the parent element.



function hideChildAndUpdateID(title) 
let parent = document.getElementById('parent');
let child = parent.firstChild;

// Hiding the child.
child.style.display = 'none';
// Temporary ID so we can find it later.
child.id = 'child-tmp-id'; // Warning occurs here



And this is the entire message from Php/WebStorm



Property id is not defined in type Node less... (Ctrl+F1) 
Inspection info: This inspection reports assignments to undefined properties of explicitly type-annotated variables.


This code itself actually works. The child element gets it's id changed to whatever I set it to, but this warning is anoying me.



I have tried using child.setAttribute('id', 'child-tmp-id'), but that did not work properly.



Is there a convention when dealing with firstChild or it's just a Php/WebStorm thingy?










share|improve this question


























    0















    Php/WebStorm is reporting this wierd warning in my JavaScript code stating that property id is not defined in the element/node. Thing is, the element is a firstChild element fetched from the parent element.



    function hideChildAndUpdateID(title) 
    let parent = document.getElementById('parent');
    let child = parent.firstChild;

    // Hiding the child.
    child.style.display = 'none';
    // Temporary ID so we can find it later.
    child.id = 'child-tmp-id'; // Warning occurs here



    And this is the entire message from Php/WebStorm



    Property id is not defined in type Node less... (Ctrl+F1) 
    Inspection info: This inspection reports assignments to undefined properties of explicitly type-annotated variables.


    This code itself actually works. The child element gets it's id changed to whatever I set it to, but this warning is anoying me.



    I have tried using child.setAttribute('id', 'child-tmp-id'), but that did not work properly.



    Is there a convention when dealing with firstChild or it's just a Php/WebStorm thingy?










    share|improve this question
























      0












      0








      0








      Php/WebStorm is reporting this wierd warning in my JavaScript code stating that property id is not defined in the element/node. Thing is, the element is a firstChild element fetched from the parent element.



      function hideChildAndUpdateID(title) 
      let parent = document.getElementById('parent');
      let child = parent.firstChild;

      // Hiding the child.
      child.style.display = 'none';
      // Temporary ID so we can find it later.
      child.id = 'child-tmp-id'; // Warning occurs here



      And this is the entire message from Php/WebStorm



      Property id is not defined in type Node less... (Ctrl+F1) 
      Inspection info: This inspection reports assignments to undefined properties of explicitly type-annotated variables.


      This code itself actually works. The child element gets it's id changed to whatever I set it to, but this warning is anoying me.



      I have tried using child.setAttribute('id', 'child-tmp-id'), but that did not work properly.



      Is there a convention when dealing with firstChild or it's just a Php/WebStorm thingy?










      share|improve this question














      Php/WebStorm is reporting this wierd warning in my JavaScript code stating that property id is not defined in the element/node. Thing is, the element is a firstChild element fetched from the parent element.



      function hideChildAndUpdateID(title) 
      let parent = document.getElementById('parent');
      let child = parent.firstChild;

      // Hiding the child.
      child.style.display = 'none';
      // Temporary ID so we can find it later.
      child.id = 'child-tmp-id'; // Warning occurs here



      And this is the entire message from Php/WebStorm



      Property id is not defined in type Node less... (Ctrl+F1) 
      Inspection info: This inspection reports assignments to undefined properties of explicitly type-annotated variables.


      This code itself actually works. The child element gets it's id changed to whatever I set it to, but this warning is anoying me.



      I have tried using child.setAttribute('id', 'child-tmp-id'), but that did not work properly.



      Is there a convention when dealing with firstChild or it's just a Php/WebStorm thingy?







      javascript dom phpstorm webstorm






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 9:30









      omerowitzomerowitz

      1,61241744




      1,61241744






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Nodes can be more than just elements and don't necessarily have an id property. Try using firstElementChild instead that returns the first child that is an element:



          function hideChildAndUpdateID(title) 
          let parent = document.getElementById('parent');
          let child = parent.firstElementChild;

          // Hiding the child.
          child.style.display = 'none';
          // Temporary ID so we can find it later.
          child.id = 'child-tmp-id';







          share|improve this answer























          • I have in the mean time used the setAttributeNode along with createAttribute and that worked too, but this is way nicer. Thanks.

            – omerowitz
            Mar 8 at 11:31










          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%2f55060264%2fproperty-id-is-not-defined-in-type-node-in-phpstorm-webstorm%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









          1














          Nodes can be more than just elements and don't necessarily have an id property. Try using firstElementChild instead that returns the first child that is an element:



          function hideChildAndUpdateID(title) 
          let parent = document.getElementById('parent');
          let child = parent.firstElementChild;

          // Hiding the child.
          child.style.display = 'none';
          // Temporary ID so we can find it later.
          child.id = 'child-tmp-id';







          share|improve this answer























          • I have in the mean time used the setAttributeNode along with createAttribute and that worked too, but this is way nicer. Thanks.

            – omerowitz
            Mar 8 at 11:31















          1














          Nodes can be more than just elements and don't necessarily have an id property. Try using firstElementChild instead that returns the first child that is an element:



          function hideChildAndUpdateID(title) 
          let parent = document.getElementById('parent');
          let child = parent.firstElementChild;

          // Hiding the child.
          child.style.display = 'none';
          // Temporary ID so we can find it later.
          child.id = 'child-tmp-id';







          share|improve this answer























          • I have in the mean time used the setAttributeNode along with createAttribute and that worked too, but this is way nicer. Thanks.

            – omerowitz
            Mar 8 at 11:31













          1












          1








          1







          Nodes can be more than just elements and don't necessarily have an id property. Try using firstElementChild instead that returns the first child that is an element:



          function hideChildAndUpdateID(title) 
          let parent = document.getElementById('parent');
          let child = parent.firstElementChild;

          // Hiding the child.
          child.style.display = 'none';
          // Temporary ID so we can find it later.
          child.id = 'child-tmp-id';







          share|improve this answer













          Nodes can be more than just elements and don't necessarily have an id property. Try using firstElementChild instead that returns the first child that is an element:



          function hideChildAndUpdateID(title) 
          let parent = document.getElementById('parent');
          let child = parent.firstElementChild;

          // Hiding the child.
          child.style.display = 'none';
          // Temporary ID so we can find it later.
          child.id = 'child-tmp-id';








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 11:21









          lenalena

          54k37685




          54k37685












          • I have in the mean time used the setAttributeNode along with createAttribute and that worked too, but this is way nicer. Thanks.

            – omerowitz
            Mar 8 at 11:31

















          • I have in the mean time used the setAttributeNode along with createAttribute and that worked too, but this is way nicer. Thanks.

            – omerowitz
            Mar 8 at 11:31
















          I have in the mean time used the setAttributeNode along with createAttribute and that worked too, but this is way nicer. Thanks.

          – omerowitz
          Mar 8 at 11:31





          I have in the mean time used the setAttributeNode along with createAttribute and that worked too, but this is way nicer. Thanks.

          – omerowitz
          Mar 8 at 11:31



















          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%2f55060264%2fproperty-id-is-not-defined-in-type-node-in-phpstorm-webstorm%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

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived