jquery

How to find nearest set of radio button and clear them

依然范特西╮ 提交于 2021-01-29 07:41:58
问题 <div class="answer"> <div class="r0"> <input type="radio" name="q31:1_answer" value="0" <?php echo ($quiz_answer1=='0' )? 'checked': ''?> id="q31:1_answer0"> <label for="q31:1_answer0" class="m-l-1">a. <break> </label> </div> <div class="r1"> <input type="radio" name="q31:1_answer" value="1" <?php echo ($quiz_answer1=='1' )? 'checked': ''?> id="q31:1_answer1"> <label for="q31:1_answer1" class="m-l-1">b. <br> </label> </div> <div class="r0"> <input type="radio" name="q31:1_answer" value="2" <

what is the right way to append all Js files using Jquery append

白昼怎懂夜的黑 提交于 2021-01-29 07:34:13
问题 I am attempting to load all js files using approach explained in this video @3:30 Optimize your code: load code at the right time I have implemented this approach in index.js as <script> var scripts = '<script src="./js/jquery-3.5.1.min.js"/>'+ '<script src="./js/jquery-ui.min.js"/>'+ '<script src="./js/bootstrap.min.js"/>'+ '<script src="./js/index.js"/>'; $(window).on("load",function(){ $("body").append(scripts) }); </script> also tried as in html head tag <script> var scripts = '<script

How to download a csv file requested through jquery/ajax from flask server [duplicate]

岁酱吖の 提交于 2021-01-29 07:30:44
问题 This question already has answers here : download file using an ajax request (12 answers) Download csv file as response on AJAX request (2 answers) Closed 2 years ago . I am building a python flask web app. I am trying to get a CSV file downloaded through jquery/ ajax call. This is how my ajax request looks like: $(".download-btn").on("click", function(){ $.ajax({ type: 'GET', url: '/downloadFile', contentType: 'csv', cache: false, processData: false, async: false, success: function(data) {

Binding array of object to Kendo grid popup multiselect

☆樱花仙子☆ 提交于 2021-01-29 07:30:25
问题 I'm trying to bind an array of id-value pairs to a kendo grid popup editor. Got everything to work for creating a new record. Popup editor loads the custom editor and successfully submits the data to the controller. The problem is when I try to edit records. The records displays properly in the row, but when I try to edit it, the multiselect does not hold the values. Grid Markup $("#ProjectSites-SubContract-grid").kendoGrid({ dataSource: { type: "json", schema: { data: "Data", total: "Total",

How do I sort by a hidden column in DataTables?

拈花ヽ惹草 提交于 2021-01-29 07:20:56
问题 When I apply DataTables to the following: <td class="years"><?php $years."-years" ?></td> <td class="..." ... ... other <td> ... my table displays as follows: 10-years ... ... ... 10-years ... ... ... 5-years ... ... ... 7-years ... ... ... 9-years ... ... ... because of the alphabetic ordering. I need 10-years to appear at the bottom. To do that I added <td class="hidden"><?php $years ?></td> right after <td class="years"><?php $years."-years" ?></td> and added "order": [ 1, 'asc' ] to the

How to remove/change an input value using javascript

倖福魔咒の 提交于 2021-01-29 07:18:17
问题 How do I remove the value 'Anonymous' in this input that I have and replace it with a placeholder text 'Your name' using javascript/jquery? I don't have access to the HTML code. This is what I have so far, but don't really know where to go from there. document.getElementById('txtYourName').placeholder =' Your Name '; HTML <input id="txtYourName" type="text" value="Anonymous" name="txtYourName"></input> 回答1: Add this second line here... A placeholder is only seen when the value happens to be

DataTables.js pagination and search not working

*爱你&永不变心* 提交于 2021-01-29 07:15:45
问题 I'm loading all my rows into DataTables via ajax. The rows are successfully loading, but nothing is paginated (however the pagination buttons are being successfully counted when the "Show 25 entries" dropdown is changed). Additionally, search is not working. No errors are being output to the console whatsoever. Here is some sample data, my DataTables JS call, and markup for the actual table. Sample JSON Data { "draw": 0, "recordsFiltered": 100, "recordsTotal": 100, "data": [ { "version": "1.0

Ajax call does not pick image in the asp dot net form?

岁酱吖の 提交于 2021-01-29 07:14:31
问题 I am working on an asp.net core application. I want to send an ajax request to the controller. My ajax function looks like this: I have an input for the user to upload a file image/file. With the current code that I have, I receive null at the controller when adds an image. Ajax request: (I Have) $("#submit").click(function (e) { e.preventDefault(); var data = $("#form1").serialize(); console.log(data); alert(data); $.ajax({ type: "post", url: "/Employee/Create", processData: false, data:

Bootstrap modal: dynamically load value in input field

瘦欲@ 提交于 2021-01-29 07:13:48
问题 I have a Bootstrap modal in a Laravel app that I'm trying to dynamically load. The idea is to fill the input fields in the modal with data coming from my database so I can update the values. I'm almost there.... I have the following in my view file: <a href="#myModal" data-toggle="modal" data-target="#edit-auction-modal" data-id="1" data-title="title 1" type="button" class="btn btn-sm btn-primary btn-warning">Open modal</a> The 'data-id' and 'data-title' are passed to a JS function that looks

ajax returns the html code of current page instead of json

早过忘川 提交于 2021-01-29 07:12:45
问题 I'm using the $.ajax function in JQuery to get JSON from a file. HTML, JavaScript and json files are in the same directory. The problem is that when i print the data returned from the success callback function it prints the HTML markup of the HTML page instead of the JSON. Here is my data.json file content: { "products":[ { "skuNum":"SKU# 105423-2", "brand":"nike running shoes", "section":"men > shoe > Running shoes", "img":"392232_004_ss_01.jpg", "price":500 }, { "skuNum":"SKU# 105423-2",