Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
No se puede seleccionar el elemento css con el mono manipulador mientras se puede en las herramientas de desarrollo

Hoy estoy muy frustrado por seleccionar el div superior en la barra lateral de la página de búsqueda de Twitter. Puedo hacerlo en las herramientas de desarrollo de Chrome, pero devuelve un valor nulo o indefinido cuando se usa el mono manipulador. ¿Puede alguien ayudarme?

 // ==UserScript== // @name twitter // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://twitter.com/* // @run-at document-end // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com // @grant none // ==/UserScript== (function() { 'use strict'; let container = document.querySelector(".css-1dbjc4n.r-vacyoi.r-ttdzmv"); console.log(container); })();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Gracias a @wOxxOm, investigué un poco y descubrí que estos códigos funcionan. desde aquí

 let classes = ".css-1dbjc4n.r-vacyoi.r-ttdzmv"; function isElement(addedNode, selector, callback) { if (typeof addedNode.querySelector === 'function' && addedNode.querySelector(selector)) { callback(); } } var elementReadyObserver = new MutationObserver(function (mutations) { for (var i=0, numMutations=mutations.length; i<numMutations; i++) { for (var j=0, numNodes=mutations[i].addedNodes.length; j<numNodes; j++) { isElement(mutations[i].addedNodes[j], classes, function() { elementReadyObserver.disconnect(); // ... and do what you want to do with the element you've been observing console.log("i found it"); let parentDiv = document.querySelector(classes); console.log(parentDiv); parentDiv.insertBefore(newDiv,parentDiv.firstChild); }); } } }); elementReadyObserver.observe(document.body, {attributes: true, subtree: true, childList: true});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!