skip to Main Content

Javascript – How can I select HTML elements which are rendered after DOM

I want to select OKBTN let main = document.querySelector("#main"); let okBtn = document.querySelector("#ok"); function myAlert(title,msg,icon){ let card = ""; card += `<div class="card"> <img src="${icon}.jpg"> <h1>${title}</h1> <p>${msg}</p> <button id="ok">OK</button> </div>`; main.innerHTML = card; } okBtn.addEventListener("click", function(){ main.style.display = "none"; });…

VIEW QUESTION

I cannot select same class elements with query selector all. I use the VS code editor – Javascript

In javascript file, I select same class element with query selector all like this... const buttons = document.querySelectorAll(".button"); In html file, I wrote like this... <!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="index.css"> </head> <body> <script…

VIEW QUESTION

jQuery : Select all Select Element with value selected only to send in ajax – Jquery ajax

I'm trying to Improve my ajax request speed so my ajax code is like this $.ajax({ url:url_option, type:'POST', dataType:'json', data:$('#product input[type='text'], #product input[type='number'], #product input[type='hidden'], #product input[type='radio']:checked, #product input[type='checkbox'], #product select, #product textarea, #product input[name='quantity']'), success:function(json){ }, }); Because I…

VIEW QUESTION
Back To Top
Search