JavaScript html id and class for js and css in same component not working html same class name,html same class different id,html

I am enabling and disabling a div by checking two radio button (yes and no) but I am facing an issue when I am putting both id and class in same div and when I am using two div (one for id as parent and another for class as child) then its working fine.

function check1() {
  if (document.getElementById("isOutsourcing_yes").checked) {
    document.getElementById("s1").hidden = false;
  }
  if (document.getElementById("isOutsourcing_no").checked) {
    document.getElementById("s1").hidden = true;
  }
}
.padd_left {
  display: inline-block;
  padding-left: 40px;
}
<input type="radio" name="isOutsourcing" id="isOutsourcing_yes" onchange="check1()" checked> Yes
<input type="radio" name="isOutsourcing" id="isOutsourcing_no" onchange="check1()"> No
    
<div id="s1" class="padd_left">
    <h1>Hello..</h1>
</div>
Answer:1

Inline blocks aren't a big fan of hidden. Try this instead

document.getElementById("s1").style.visibility = "hidden"; // or visible

Also note the difference between the display property and the visibility property. You could set it to display: none if you wanted it to completely disappear from the page without a trace (besides in the source). visibility: hidden will have it take up the same space but not render anything. Depending on how you want your page to look, you'll have to make that decision.

https://www.w3schools.com/jsref/prop_style_visibility.asp

https://www.w3schools.com/cssref/pr_class_display.asp

Answer:2

Is it possible to get the scroll event fired with onsen ? I tried to remove the onsen css file and it worked, the scroll event was fired. But that's no solution -.- I also tried the ons-scroller tag ...

Is it possible to get the scroll event fired with onsen ? I tried to remove the onsen css file and it worked, the scroll event was fired. But that's no solution -.- I also tried the ons-scroller tag ...

  1. onsen ui scroll event

I have the following jsfiddle example (check the console) and all you will see is [object Object] instead of person data: So, basically I have a vuejs instance and a div for v-for to iterate an ...

I have the following jsfiddle example (check the console) and all you will see is [object Object] instead of person data: So, basically I have a vuejs instance and a div for v-for to iterate an ...

  1. vuejs data return object
  2. vuejs computed return object

Supposing I have an HTML Table and each row has Some data, an Update and a Delete Button. I want, by clicking on the Update Button, to retrieve every data THIS SPECIFIC ROW has. I have searched for ...

Supposing I have an HTML Table and each row has Some data, an Update and a Delete Button. I want, by clicking on the Update Button, to retrieve every data THIS SPECIFIC ROW has. I have searched for ...

How can I detect when a Bootstrap affixed element has returned to its starting position and is no longer affixed?

How can I detect when a Bootstrap affixed element has returned to its starting position and is no longer affixed?