skip to Main Content

Why option element not appending inside both select tag only appending at last select tag? – Html

Html: <div class="from"> <select name="" class="droplistOptions" > <!--insert option element here--> </select> </div> <p class="to-seprator">To</p> <div class="to"> <select name="" class="droplistOptions" > <!--insert option element here also --> </select> </div> Javascript Code: const droplists = document.querySelectorAll('.droplistOptions'); countryNames = ['usa', 'India', 'china',…

VIEW QUESTION

Parse html fragment that contains a table row

I have the following response returned from a server. It's a html fragment. I want to parse it with DOMParser like this: let responseText = '<div>Text Content</div><tr><td>Cell</td></tr>'; let doc = new DOMParser().parseFromString(`<body><template>${responseText}</template></body>`, 'text/html'); let fragment = doc.body.firstChild.content; Here the fragment…

VIEW QUESTION
Back To Top
Search