jQuery data-bind trigger change

I’m working on a browser extension and I need to activate a select in a website to change a value. I am using jQuery but I am a bit lost with the trigger methods. This is the select that I want to change the value: <select name=”subMonths” class=”select number_weeks” id=”sub_duration” data-bind=” options: options.durationOptions, optionsText: ‘val’,…

jQuery UI datepicker setDate and moment.js

jQueryUI datepicker doesn’t seem to play nicely with moment.js I need my datepicker to preset to last 90 days, so FromDate should be 90 days ago and ToDate is today. $(‘#FromDate’).datepicker({ format: ‘dd-M-yyyy’, todayHighlight: true, autoclose: true, orientation: ‘auto bottom’ }); $(‘#ToDate’).datepicker({ format: ‘dd-M-yyyy’, todayHighlight: true, autoclose: true, orientation: ‘auto bottom’ }); var todate =…

Rails 6 + Webpack, Datatables, jQuery

I have a “Select All” button that uses this code: <script type=’text/javascript’> $(‘#check_all’).on(“click”, function() { $(‘input[type=”checkbox”]’).click(); }); </script> Since I upgraded to Rails 6 + Webpacker, it stopped working. The console shows this error: Uncaught ReferenceError: $ is not defined I managed to fix it by altering environment.js from: environment.plugins.append(‘Provide’, new webpack.ProvidePlugin({ $: ‘jquery’, jQuery:…

jQuery function not calling on modal close

I want to call a function that processes my datatable at the serverside when I close a bootstrap modal. This is my jquery $(‘#launch’).on(‘hidden.bs.modal’, function () { fill_datatable(); console.log(123); }); console.log(333); function fill_datatable(filter_status = ”){ var dataTable = $(‘#dataTable2’).DataTable({ “processing” : true, “pageLength”: 25, “columnDefs”: [ { “searchable”: true, “targets”: 0 } ], “serverSide” :…

How format with commas in jQuery-UI slider?

Here I’ve used jquery-ui.js so that it shows numbers from 0 to 2000000 and I’d like to show long number formatted like 2,000,000 <a id=”minamount” style=””>0</a> <a id=”maxamount” style=””>2000000</a> javascript: $(“.slider”).slider({ min: 0, max: 2000000, values: [0, 2000000], range: true, step: 10, slide: function (event, ui) { $(“#minamount”).html(ui.values[0]); $(“#maxamount”).html(ui.values[1]); } });

jquery autocomplete with callback ajax json elasticsearch

When is make a response to Elasticsearch this is happening: http://localhost:9200/hobbie/_search?callback=jQuery112407134696443551507_1568816372627&term=hobby&_=1568816372628. I really don’t know why the callback is in the request. Those anyone knows what i did wrong? It would be a great help. $( function() { function log( message ) { $( “<div>” ).text( message ).prependTo( “#log” ); $( “#log” ).scrollTop( 0 );…

Wrap text in span after string – using jquery/javascript

I want to wrap text in span after the word “Price” using JavaScript/JQuery not php. I tried following but it is not working. I used an expression which I know from PHP. $(‘h2#Price’).text().replace(/(.*?)Price(.*?)/, ‘$1 Price <span>$2</span>’); span { background-color:yellow } <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <h2 id=”Price”>T-shirt Price in Canada</h2> I want to wrap “in Canada” in span.