jquery

How to set the index for a dynamically changing table?

余生颓废 提交于 2021-01-28 03:15:37
问题 I have created a form where you can add or delete table rows using javascript and jQuery. I would like to know how I can obtain and set the index for each table row such that sequence is maintained even if I were to delete and element from the middle of the table. The table is of the form: <thead> <tr> <th>Index</th> <th>Name</th> <th>Property</th> <th>Edit/Delete</th> </tr> </thead> <tbody> <tr> <td class="index">Index goes here (1)</td> <td>NameOne</td> <td>PropOne</td> <td><span class=

Replace image src and a href onclick

时光怂恿深爱的人放手 提交于 2021-01-28 03:12:36
问题 I've got this little project where I want to swap an image for another, and display the new image in a lightbox. The code below works as follows; when I click one of the small images, the image src of the large image is replaced with the src of the small image. However, when I click the large image, it still opens the default large image in my lightbox. Is there any way I can make the hyperlink href get swapped the same way the image src is swapped? They need to get the same value. The

Bootstrap colorpicker basic example does not work

最后都变了- 提交于 2021-01-28 03:11:28
问题 I would like to use a color picker plugin for bootstrap : https://farbelous.io/bootstrap-colorpicker/index.html It uses bootstrap 4 and Jquery When trying the very basic code example, published by the developer, in my website or in JS Fiddle, the color picker just does not work properly (you should see a clickable square on the left and be able to pick a color with it) JsFiddle What am I doing wrong ? I thought it might be the imports that did not work, so I used CDNs but it does not change

Is it possible to cancel print in javascript

前提是你 提交于 2021-01-28 02:44:14
问题 I am using the code found here: Detecting browser print event to detect if the user wants to print the page. So far it works as intended. In the "afterPrint"-function I call a function which creates and appends an iframe containing another page with a different, and much more printfriendly layout of what needs to be printed: function printIframe (printsrc) { var iframe = $('iframe#print'); if (iframe.length == 0) iframe = $('<iframe id="print" />').attr('src', printsrc).css("width", "0px")

I'm struggling to get this jquery slide down and up to work

别来无恙 提交于 2021-01-28 02:18:44
问题 The div I'm animating in jquery is supposed to slide out to expand the width. I've gotten the width animation to work but after adding the slideDown and up code nothing works, the way it should work is: Enquiries should be clicked and it expands and after it expands the. For slides down and when its clicked again, first the fork slides up and then the ENQUIRIES- shown goes back to its original width. I'm not sure where my codes gone wrong as I'm new to jquery and java script. THANK YOU FOR

How to combine search in table by two input text fields?

China☆狼群 提交于 2021-01-28 02:17:48
问题 My table looks like this: <table> <tr> <td>Apple</td> <td>Green</td> </tr> <tr> <td>Grapes</td> <td>Green</td> </tr> <tr> <td>Orange</td> <td>Orange</td> </tr> </table> The searching javascript as follows: var $rows = $('#table tr'); $('#search').keyup(function() { var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase(); $rows.show().filter(function() { var text = $(this).text().replace(/\s+/g, ' ').toLowerCase(); return !~text.indexOf(val); }).hide(); }); Look at this example to

Play song at specific time position from a playlist

不想你离开。 提交于 2021-01-28 02:16:23
问题 I am using jPlayer plugin. In example there are 13 songs in playlist. I want to set a start time (currentTime) for each song like : 1st song starts from 2 sec, 2nd song start from 3 sec and 5th song start from 4 sec. Here is an example jsFiddle. In this example I added var tag = $('.audio-tag audio')[0]; to find current playing song globally but it is out of jPlayer plugin. How to get current audio tag & number to set currentTime for each song of jPlayer playlist? 回答1: SOLUTION var $jp = $('

How to get value of selected dropdown value on button click in jquery

耗尽温柔 提交于 2021-01-28 02:11:27
问题 I am using Bootstrap with jquery to create a dynamic table consisting dropdown menu and button. I want to get value of dropdown menu selected in jquery on button click. Below is my code <table class="table table-bordered"> <tbody> {% for item in items %} <tr> <td> <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Select </button> <ul class="dropdown-menu" role="menu"

Get the id on modal when click on anchor tag for open modal using php

泪湿孤枕 提交于 2021-01-28 01:59:35
问题 I have a modal open on click anchor tag and passing the id value in input hidden field using javascript and value is show in this hidden field <a href="#modal2" data-toggle="modal" data-id="<?php echo $CRow['id'];?>" id="<?php echo $CRow['id'];?>" class="btn-floating waves-effect waves-light yellow modal-trigger" title="Test"></a> <div id="modal2" class="modal"> <form action="lst_applicant.php" method="post" enctype="multipart/form-data"> <div class="modal-content"> <input type="hidden" id=

Bootstrap modal open on clicking image

泄露秘密 提交于 2021-01-28 01:53:38
问题 when i click menu-5_1.png the below model should pop up <li class="men_5l" ><a id = "pop" href="#"><span><img src="images/menu_5_1.PNG" alt=""></span> <p>Mp3</p></a></li> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> ×</button> <h4 class="modal-title" id