skip to Main Content

jQuery match element by id and class

I need to catch some elements in a form. The elements look like this: <div id="wpforms-22603-field_17-container" class="wpforms-field wpforms-field-likert_scale" data-field-id="17"> <div id="wpforms-22603-field_18-container" class="wpforms-field wpforms-field-likert_scale" data-field-id="18"> <div id="wpforms-22603-field_19-container" class="wpforms-field wpforms-field-likert_scale" data-field-id="19"> The variable part is the number after -field_ and of course…

VIEW QUESTION

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