简体   繁体   中英

how call a javascript code in a specific blazor page

Im converting a website in blazor, i have a page where at the end ther's this javascript

(function ($) {
    "use strict";
    $(document).ready(function () {
        $('#slider-range').slider({
          ..... more

How can i call it in blazor? I did not find a solution that works

Thanx

Yes it can work, the problem is blazor does not understand $ jquery selector, you need to replace it with document in .js script for it to work. for example, change $('#slider-range').slider({ to document.getElementById('#slider-range').slider({ then this line will work and same for everyplace where $ is present. And just remove it from function definition like this (function () {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM