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

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page