New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tb-no-more-get-document-by-id

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tb-no-more-get-document-by-id

$tb('#example').innerText = 'Content Changed';

  • 1.0.7
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Install

npm install tb-no-more-get-document-by-id

copy dist folder to your public directory

<script src="/dist/no-more-get-document-by-id.js"></script>
    

Description

If You Don't Have jQuery or prototype.js

And If You Are Writing document.getElementById('example');

Then You Can Use $tb('#example').innerHTML = '<div>Content Changed</div>';

The Same For Classes document.getElementByClassName('example');

Then You Have An Array Of The Elements With The class example

let example = $tb('.example') is an array 

so you can loop through the example variable or target the first

$tb('.example')[0];

You Can Do The Same For Tag Names The Same As You Do For Classes

$tb('div')[0];

You Can Then Append Regular JS
TESTS

screenshot

Examples
      //target element with id='test' 
      $tb('#test').innerText = 'Content Changed';
 
      //target all div elements   
      let tb =  $tb('div');

      for(let i =0; i<= tb.length-1; i++) {
           tb[i].innerHTML= 'Content Changed';
      }
      
      //target all elements with a class of example
       let example =  $tb('.example');
  
       for(let i =0; i<= example.length-1; i++) {
           example[i].innerHTML= 'Content Changed';
       }
       
       //input setting and getting values
        $tb('#test').value = 15;
       
        console.log($tb('#test').value);

Keywords

FAQs

Package last updated on 31 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc