[ANSWERED] javascript – How to extract the value</a> </h1> <div class="media mg-info-author-block"> <a class="mg-author-pic" href="https://esgsw.it/author/"> <img alt='' src='https://secure.gravatar.com/avatar/?s=150&d=mm&r=g' srcset='https://secure.gravatar.com/avatar/?s=300&d=mm&r=g 2x' class='avatar avatar-150 photo avatar-default' height='150' width='150' loading='lazy' decoding='async'/> </a> <div class="media-body"> <h4 class="media-heading"><span>By</span><a href="https://esgsw.it/author/"></a></h4> <span class="mg-blog-date"><i class="fas fa-clock"></i> Nov 18, 2022</span> <span class="newsup-tags"><i class="fas fa-tag"></i> <a href="https://esgsw.it/html/answered-javascript-how-to-extract-the-value/"><a href="https://esgsw.it/tag/google-tag-manager/" rel="tag">google-tag-manager</a>, <a href="https://esgsw.it/tag/html/" rel="tag">html</a>, <a href="https://esgsw.it/tag/javascript/" rel="tag">javascript</a></a> </span> </div> </div> </div> <article class="small single"> <h1>Solution 1 : </h1> <div class="s-prose js-post-body" itemprop="text"> <p>You can extract the title. You just have to scramble through.</p> <div class="snippet" data-babel="false" data-console="true" data-hide="false" data-lang="js"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>t = document.querySelector('#scheduleContainer svg title').innerHTML console.log(t)</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><div id="scheduleContainer"> <div> <div> <svg> <title>Hello</title> <path> </svg> </div> </div> </div></code></pre> </div> </div> </div> <h1>Solution 2 : </h1> <div class="s-prose js-post-body" itemprop="text"> <p>in javascript, using <code>document.title</code> should be enough</p> </div> <h1>Problem :</h1> <div class="s-prose js-post-body" itemprop="text"> <p>JS is not my main skill, hope someone can help. I am trying to make a GTM variable to extract . Problem is that I cant use class=”rg-trailer-icon” as a class name because it changes based on the truck type that is viewed (trailer, truck, etc)</p> <p><a href="https://i.stack.imgur.com/FtzJw.png" rel="nofollow noreferrer noopener" target="_blank"><img decoding="async" alt="enter image description here" src="https://i.stack.imgur.com/FtzJw.png"/></a></p> <p>Thank you!</p> </div> <h1>Comments</h1> <h3>Comment posted by Liftoff</h3> <p></p> <p class="has-small-font-size">Are there any other titled SVGs on the page? If not you could use </p> <p></p> <h3>Comment posted by user3191724</h3> <p></p> <p class="has-small-font-size">Thank you All! this did the job : document.querySelector(‘#scheduleContainer svg title’).innerHTML</p> <p></p> <h3>Comment posted by Maik Lowrey</h3> <p></p> <p class="has-small-font-size">@user3191724 Thank you for Feedback! You welcome!</p> <p></p> <h3>Comment posted by user3191724</h3> <p></p> <p class="has-small-font-size">Unfortunately, it’s not a page title 🙂</p> <p></p> <h3>Comment posted by dup</h3> <p></p> <p class="has-small-font-size">Oops, sorry, I didn’t notice. maybe jquery would help in that case… anyways I’m glad someone already helped 😀</p> <p></p> <script> function pinIt() { var e = document.createElement('script'); e.setAttribute('type','text/javascript'); e.setAttribute('charset','UTF-8'); e.setAttribute('src','https://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999); document.body.appendChild(e); } </script> <div class="post-share"> <div class="post-share-icons cf"> <a href="https://www.facebook.com/sharer.php?u=https://esgsw.it/html/answered-javascript-how-to-extract-the-value/" class="link facebook" target="_blank" > <i class="fab fa-facebook"></i></a> <a href="http://twitter.com/share?url=https://esgsw.it/html/answered-javascript-how-to-extract-the-value/&text=%5BANSWERED%5D%20javascript%20%E2%80%93%20How%20to%20extract%20the%20%20value" class="link twitter" target="_blank"> <i class="fab fa-twitter"></i></a> <a href="mailto:?subject=%5BANSWERED%5D%20javascript%20%26#8211;%20How%20to%20extract%20the%20%20value&body=https://esgsw.it/html/answered-javascript-how-to-extract-the-value/" class="link email" target="_blank" > <i class="fas fa-envelope"></i></a> <a href="https://www.linkedin.com/sharing/share-offsite/?url=https://esgsw.it/html/answered-javascript-how-to-extract-the-value/&title=%5BANSWERED%5D%20javascript%20%E2%80%93%20How%20to%20extract%20the%20%20value" class="link linkedin" target="_blank" > <i class="fab fa-linkedin"></i></a> <a href="https://telegram.me/share/url?url=https://esgsw.it/html/answered-javascript-how-to-extract-the-value/&text&title=%5BANSWERED%5D%20javascript%20%E2%80%93%20How%20to%20extract%20the%20%20value" class="link telegram" target="_blank" > <i class="fab fa-telegram"></i></a> <a href="javascript:pinIt();" class="link pinterest"><i class="fab fa-pinterest"></i></a> </div> </div> <div class="clearfix mb-3"></div> <nav class="navigation post-navigation" aria-label="Posts"> <h2 class="screen-reader-text">Post navigation</h2> <div class="nav-links"><div class="nav-previous"><a href="https://esgsw.it/html/answered-html-i-cant-align-2-rows-horizontally/" rel="prev">[ANSWERED] html – I can’t align 2 rows horizontally <div class="fas fa-angle-double-right"></div><span></span></a></div><div class="nav-next"><a href="https://esgsw.it/html/answered-html-how-to-hide-borders-when-resizing-images/" rel="next"><div class="fas fa-angle-double-left"></div><span></span> [ANSWERED] html – How to hide borders when resizing images?</a></div></div> </nav> </article> </div> <div class="media mg-info-author-block"> <a class="mg-author-pic" href="https://esgsw.it/author/"><img alt='' src='https://secure.gravatar.com/avatar/?s=150&d=mm&r=g' srcset='https://secure.gravatar.com/avatar/?s=300&d=mm&r=g 2x' class='avatar avatar-150 photo avatar-default' height='150' width='150' loading='lazy' decoding='async'/></a> <div class="media-body"> <h4 class="media-heading">By <a href ="https://esgsw.it/author/"></a></h4> <p></p> </div> </div> <div class="mg-featured-slider p-3 mb-4"> <!--Start mg-realated-slider --> <div class="mg-sec-title"> <!-- mg-sec-title --> <h4>Related Post</h4> </div> <!-- // mg-sec-title --> <div class="row"> <!-- featured_post --> <!-- blog --> <div class="col-md-4"> <div class="mg-blog-post-3 minh back-img" > <div class="mg-blog-inner"> <div class="mg-blog-category"> <a class="newsup-categories category-color-1" href="https://esgsw.it/category/html/" alt="View all posts in HTML"> HTML </a> </div> <h4 class="title"> <a href="https://esgsw.it/html/answered-javascript-locomotive-scroll-not-working-with-vue-js-when-having-to-load-images-on-page/" title="Permalink to: [ANSWERED] javascript – Locomotive Scroll not working with Vue.js when having to load images on page"> [ANSWERED] javascript – Locomotive Scroll not working with Vue.js when having to load images on page</a> </h4> <div class="mg-blog-meta"> <span class="mg-blog-date"><i class="fas fa-clock"></i> Nov 20, 2022</span> <a href="https://esgsw.it/author/"> <i class="fas fa-user-circle"></i> </a> </div> </div> </div> </div> <!-- blog --> <!-- blog --> <div class="col-md-4"> <div class="mg-blog-post-3 minh back-img" > <div class="mg-blog-inner"> <div class="mg-blog-category"> <a class="newsup-categories category-color-1" href="https://esgsw.it/category/html/" alt="View all posts in HTML"> HTML </a> </div> <h4 class="title"> <a href="https://esgsw.it/html/answered-html-how-to-import-veiw-stl-files-in-a-wordpress-website/" title="Permalink to: [ANSWERED] html – How to import/veiw STL files in a wordpress website?"> [ANSWERED] html – How to import/veiw STL files in a wordpress website?</a> </h4> <div class="mg-blog-meta"> <span class="mg-blog-date"><i class="fas fa-clock"></i> Nov 20, 2022</span> <a href="https://esgsw.it/author/"> <i class="fas fa-user-circle"></i> </a> </div> </div> </div> </div> <!-- blog --> <!-- blog --> <div class="col-md-4"> <div class="mg-blog-post-3 minh back-img" > <div class="mg-blog-inner"> <div class="mg-blog-category"> <a class="newsup-categories category-color-1" href="https://esgsw.it/category/html/" alt="View all posts in HTML"> HTML </a> </div> <h4 class="title"> <a href="https://esgsw.it/html/answered-javascript-how-to-handle-repeating-values-in-jquery/" title="Permalink to: [ANSWERED] javascript – How to handle repeating values in JQuery"> [ANSWERED] javascript – How to handle repeating values in JQuery</a> </h4> <div class="mg-blog-meta"> <span class="mg-blog-date"><i class="fas fa-clock"></i> Nov 20, 2022</span> <a href="https://esgsw.it/author/"> <i class="fas fa-user-circle"></i> </a> </div> </div> </div> </div> <!-- blog --> </div> </div> <!--End mg-realated-slider --> </div> <!--sidebar--> <!--col-md-3--> <aside class="col-md-3"> <aside id="secondary" class="widget-area" role="complementary"> <div id="sidebar-right" class="mg-sidebar"> <div id="block-2" class="mg-widget widget_block widget_search"><form role="search" method="get" action="https://esgsw.it/" class="wp-block-search__button-outside wp-block-search__text-button wp-block-search"><label for="wp-block-search__input-1" class="wp-block-search__label" >Search</label><div class="wp-block-search__inside-wrapper " ><input type="search" id="wp-block-search__input-1" class="wp-block-search__input wp-block-search__input" name="s" value="" placeholder="" required /><button type="submit" class="wp-block-search__button wp-element-button" >Search</button></div></form></div><div id="block-3" class="mg-widget widget_block"><div class="is-layout-flow wp-block-group"><div class="wp-block-group__inner-container"><h2>Recent Posts</h2><ul class="wp-block-latest-posts__list wp-block-latest-posts"><li><a class="wp-block-latest-posts__post-title" href="https://esgsw.it/html/answered-javascript-text-box-to-display-updated-text-and-save-on-button-click/">[ANSWERED] javascript – Text box to display updated text and save on button click</a></li> <li><a class="wp-block-latest-posts__post-title" href="https://esgsw.it/html/answered-javascript-pass-html-tag-to-angularjs-variable-from-controller/">[ANSWERED] javascript – Pass html tag to angularjs variable from controller</a></li> <li><a class="wp-block-latest-posts__post-title" href="https://esgsw.it/html/answered-html-bootstrap-mobile-menu-not-scrolling-instead-the-background-is-scrolling/">[ANSWERED] html – bootstrap mobile menu not scrolling instead the background is scrolling</a></li> <li><a class="wp-block-latest-posts__post-title" href="https://esgsw.it/html/answered-html-how-to-play-live-stream-youtube-videos-using-cef4delphi/">[ANSWERED] html – How to play live stream YouTube videos using CEF4Delphi?</a></li> <li><a class="wp-block-latest-posts__post-title" href="https://esgsw.it/html/answered-html-how-to-include-a-clickable-image-behind-a-link/">[ANSWERED] html – How to include a clickable image behind a link</a></li> </ul></div></div></div><div id="block-4" class="mg-widget widget_block"><div class="is-layout-flow wp-block-group"><div class="wp-block-group__inner-container"><h2>Recent Comments</h2><div class="no-comments wp-block-latest-comments">No comments to show.</div></div></div></div> </div> </aside><!-- #secondary --> </aside> <!--/col-md-3--> <!--/sidebar--> </div> </div> </main> <div class="container-fluid mr-bot40 mg-posts-sec-inner"> <div class="missed-inner"> <div class="row"> <div class="col-md-12"> <div class="mg-sec-title"> <!-- mg-sec-title --> <h4>You missed</h4> </div> </div> <!--col-md-3--> <div class="col-md-3 col-sm-6 pulse animated"> <div class="mg-blog-post-3 minh back-img" > <a class="link-div" href="https://esgsw.it/html/answered-javascript-text-box-to-display-updated-text-and-save-on-button-click/"></a> <div class="mg-blog-inner"> <div class="mg-blog-category"> <a class="newsup-categories category-color-1" href="https://esgsw.it/category/html/" alt="View all posts in HTML"> HTML </a> </div> <h4 class="title"> <a href="https://esgsw.it/html/answered-javascript-text-box-to-display-updated-text-and-save-on-button-click/" title="Permalink to: [ANSWERED] javascript – Text box to display updated text and save on button click"> [ANSWERED] javascript – Text box to display updated text and save on button click</a> </h4> <div class="mg-blog-meta"> <span class="mg-blog-date"><i class="fas fa-clock"></i> <a href="https://esgsw.it/2022/11/"> Nov 20, 2022</a></span> <a class="auth" href="https://esgsw.it/author/"><i class="fas fa-user-circle"></i> </a> </div> </div> </div> </div> <!--/col-md-3--> <!--col-md-3--> <div class="col-md-3 col-sm-6 pulse animated"> <div class="mg-blog-post-3 minh back-img" > <a class="link-div" href="https://esgsw.it/html/answered-javascript-pass-html-tag-to-angularjs-variable-from-controller/"></a> <div class="mg-blog-inner"> <div class="mg-blog-category"> <a class="newsup-categories category-color-1" href="https://esgsw.it/category/html/" alt="View all posts in HTML"> HTML </a> </div> <h4 class="title"> <a href="https://esgsw.it/html/answered-javascript-pass-html-tag-to-angularjs-variable-from-controller/" title="Permalink to: [ANSWERED] javascript – Pass html tag to angularjs variable from controller"> [ANSWERED] javascript – Pass html tag to angularjs variable from controller</a> </h4> <div class="mg-blog-meta"> <span class="mg-blog-date"><i class="fas fa-clock"></i> <a href="https://esgsw.it/2022/11/"> Nov 20, 2022</a></span> <a class="auth" href="https://esgsw.it/author/"><i class="fas fa-user-circle"></i> </a> </div> </div> </div> </div> <!--/col-md-3--> <!--col-md-3--> <div class="col-md-3 col-sm-6 pulse animated"> <div class="mg-blog-post-3 minh back-img" > <a class="link-div" href="https://esgsw.it/html/answered-html-bootstrap-mobile-menu-not-scrolling-instead-the-background-is-scrolling/"></a> <div class="mg-blog-inner"> <div class="mg-blog-category"> <a class="newsup-categories category-color-1" href="https://esgsw.it/category/html/" alt="View all posts in HTML"> HTML </a> </div> <h4 class="title"> <a href="https://esgsw.it/html/answered-html-bootstrap-mobile-menu-not-scrolling-instead-the-background-is-scrolling/" title="Permalink to: [ANSWERED] html – bootstrap mobile menu not scrolling instead the background is scrolling"> [ANSWERED] html – bootstrap mobile menu not scrolling instead the background is scrolling</a> </h4> <div class="mg-blog-meta"> <span class="mg-blog-date"><i class="fas fa-clock"></i> <a href="https://esgsw.it/2022/11/"> Nov 20, 2022</a></span> <a class="auth" href="https://esgsw.it/author/"><i class="fas fa-user-circle"></i> </a> </div> </div> </div> </div> <!--/col-md-3--> <!--col-md-3--> <div class="col-md-3 col-sm-6 pulse animated"> <div class="mg-blog-post-3 minh back-img" > <a class="link-div" href="https://esgsw.it/html/answered-html-how-to-play-live-stream-youtube-videos-using-cef4delphi/"></a> <div class="mg-blog-inner"> <div class="mg-blog-category"> <a class="newsup-categories category-color-1" href="https://esgsw.it/category/html/" alt="View all posts in HTML"> HTML </a> </div> <h4 class="title"> <a href="https://esgsw.it/html/answered-html-how-to-play-live-stream-youtube-videos-using-cef4delphi/" title="Permalink to: [ANSWERED] html – How to play live stream YouTube videos using CEF4Delphi?"> [ANSWERED] html – How to play live stream YouTube videos using CEF4Delphi?</a> </h4> <div class="mg-blog-meta"> <span class="mg-blog-date"><i class="fas fa-clock"></i> <a href="https://esgsw.it/2022/11/"> Nov 20, 2022</a></span> <a class="auth" href="https://esgsw.it/author/"><i class="fas fa-user-circle"></i> </a> </div> </div> </div> </div> <!--/col-md-3--> </div> </div> </div> <!--==================== FOOTER AREA ====================--> <footer> <div class="overlay" style="background-color: ;"> <!--Start mg-footer-widget-area--> <!--End mg-footer-widget-area--> <!--Start mg-footer-widget-area--> <div class="mg-footer-bottom-area"> <div class="container-fluid"> <div class="divide-line"></div> <div class="row align-items-center"> <!--col-md-4--> <div class="col-md-6"> <div class="site-branding-text"> <h1 class="site-title"> <a href="https://esgsw.it/" rel="home">Bollate</a></h1> <p class="site-description"></p> </div> </div> <div class="col-md-6 text-right text-xs"> <ul class="mg-social"> <a target="_blank" href=""> <a target="_blank" href=""> </ul> </div> <!--/col-md-4--> </div> <!--/row--> </div> <!--/container--> </div> <!--End mg-footer-widget-area--> <div class="mg-footer-copyright"> <div class="container-fluid"> <div class="row"> <div class="col-md-6 text-xs"> <p> <a href="https://wordpress.org/"> Proudly powered by WordPress </a> <span class="sep"> | </span> Theme: Newspaperex by <a href="https://themeansar.com/" rel="designer">Themeansar</a>. </p> </div> <div class="col-md-6 text-right text-xs"> <ul class="info-right"><li class="nav-item menu-item "><a class="nav-link " href="https://esgsw.it/" title="Home">Home</a></li></ul> </div> </div> </div> </div> </div> <!--/overlay--> </footer> <!--/footer--> </div> <!--/wrapper--> <!--Scroll To Top--> <a href="#" class="ta_upscr bounceInup animated"><i class="fa fa-angle-up"></i></a> <!--/Scroll To Top--> <!-- /Scroll To Top --> <script> jQuery('a,input').bind('focus', function() { if(!jQuery(this).closest(".menu-item").length && ( jQuery(window).width() <= 992) ) { jQuery('.navbar-collapse').removeClass('show'); }}) </script> <script type='text/javascript' src='https://esgsw.it/wp-content/themes/newsup/js/custom.js?ver=6.1.1' id='newsup-custom-js'></script> <script type='text/javascript' src='https://esgsw.it/wp-content/themes/newsup/js/custom-time.js?ver=6.1.1' id='newsup-custom-time-js'></script> <script> /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1); </script> </body> </html> <!-- Page generated by LiteSpeed Cache 5.3 on 2023-09-22 11:17:59 -->