Answers for "jquery in angular 13"

-1

use jquery in angular

// In the console
// First install jQuery
npm install --save jquery
// and jQuery Definition
npm install -D @types/jquery

=======================================(in angular)
import * as $ from 'jquery';
//
$('#elemId').width();

// OR

// CommonJS style - working with "require"
import $ = require('jquery')
//
$('#elemId').width();
Posted by: Guest on August-21-2021
0

jquery in Angular

//first step:
npm install --save jquery

npm install -D @types/jquery

//secong step:
"scripts": [ "node_modules/jquery/dist/jquery.min.js" ]

//third step:
<script type="text/javascript" src="assets/js/jquery-2.1.1.min.js"></script>

//fourth step in .ts file:
import * as $ from 'jquery';

ngOnInit(): void {
    this.GET_LOGIN_FORM_VALUE();

    $(document).ready(() => {
      $("button").click(() => {
        $("h3").css("color", "red");
      });
    });
  }
Posted by: Guest on April-16-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language