html - JavaScript: Get next element from Parent -


I want to disable the next element of the parent of a tag:
html:

  & lt; Period & gt; & Lt; Input type = "checkbox" onchange = "disableInput (this)" & gt; & Lt; / Span & gt; & Lt; Input type = "text" / & gt; & Lt ;! - When the checkbox is changed, disable the input field - & gt;  

Javascript:

  & lt; Script & gt; Function disable input (element) {element.parentNode.nextSibling.disabled = true; } & Lt; / Script & gt;  

Was it not working Can someone help me?

Try it Next to the next symboling in the text nodes (including spaces) , But is not the next element sibling .

  function disable input (element) {element.parentNode NextElementSibling.disabled = true; }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -