Why my radio buttons are not taking if else statement in javascript file?

<input id=”text1″ placeholder=”Enter Anything”> <input id=”rd1″ name=”grp1″ type=”radio” value=”gurukul”>Gurukul</input> <input id=”rd2″ name=”grp1″ type=”radio” value=”NEET”>NEET</input> <br> <button onclick=”fn1()” id=”btn1″>Click Me</button> Code for Js file is function fn1() { var str = document.getElementById(“text1”).value; var rd1 = document.getElementById(“rd1”).value; var rd2 = document.getElementById(“rd2”).value; if(rd1.checked){ alert(“Value inside the text box is”+ str + “Welcome to”+rd1.value); } else if(rd2.checked){ alert(“Value inside…

Javascript show more button in table

I need to show another tbody of table on Click. I have following table which is in foreach so there will be multiple buttons.: <table class=”table” id=”call-table”> <tr> <th>Show more buttons</th> </tr> <tbody> <tr> <td class=”show-more-button”>Show more</td> //It will open first tbody <tr> <tr> <td class=”show-more-button”>Show more</td> //It will open second tbody <tr> <tbody class=”show-more”>…

Javascript slider not working as expected

I am using Sly library for sliding a couple of divs. I am following their syntax: <div id=”wrapperSly”> <div class=”frame” id=”weatherSlider”> <div id=”slidee”> <div id=”0hrs”> <div id=”0time”></div> <div id=”0currTemp”>&deg</div> </div> </div> </div> </div> // js file: let slyFrame = $(‘#weatherSlider’); let $slidee = $(‘#slidee’); let $wrap = slyFrame.parent(); // slyFrame.sly(false); // Call Sly on frame…

How To Change stylesheet by javascript

I’ve try’s to get element and change the style by content: if element content is ‘English’ then stylesheet should be ‘ltr.css’ elseif element content is ‘Persian’ the stylesheet should be ‘rtl.css’ here is what i have addEventListener(“DOMContentLoaded”, () => { var lang = document.getElementById(‘languageChooser’).innerHTML; if(lang == ‘Persian’){ document.querySelector(‘#style1’).setAttribute(‘href’, ‘rtl.css’);; } else (lang == ‘English’) {…