remove previous element only if it is of type <hr>?
Starting with <hr> <div class="aaa">...</div> ... <p> <div class="aaa">...</div> I want to remove the previous element of <div class="aaa"> elements but ONLY if it is a <hr> element $("div.aaa").prev().remove(); removes them all. How can specify only <hr>-removals?
Remove whole table when inside a class is matched?
At first the code: <table> <tbody> <tr> <td > <div class="foobar">....</div> ...</td> </tr> </tbody> </table> When a table contains a certain class the whole table should be removed. The following does NOT work: $("table .foobar").remove(); How else?
How to remove following simple text without enclosing element?
Assume the following code <p class="firstclass">.....</p> foobar some text <p class="secondclass">.....</p> some other text Now when I apply $(".firstclass").nextAll().remove(); then the text following the <p>firstclass element is NOT removed since it is not enclosed in an element. As I learned nextAll() fetches only elements. How can I otherwise remove ALL following stuff after <p> firstclass? Peter
Getting the text value of all child elements
I have this html: <div id="codes"> <div><a href="#"></a><span>bla</span></div> <div><a href="#"></a><span>bla2</span></div> <div><a href="#"></a><span>bla3</span></div> </div>How can i get the value of all those child spans? Thank you in advance.
How to delete whole "@media print { ...}" CSS instructions?
Oftentimes web pages include a separate *.css file and put separate special CSS instructions inside for printing the article. How can I delete with jQuery this @media print { ............. } rule / instruction? Peter
Does order by is preserved by $.each()
q1) I have sorted the "var dd" first then I have iterated using "each", does the order in dd is followed by "each" or it can change the order in any case? q2) do all the loops honour the sort order? q3) if I declare the "var dd" as global var and sort it, then will it preserver the order inside the "var dd" all the time or is there any case where it can change? q4) when we get data ordered from database using ajax function of jquery, is the data remains ordered or it can change in any case? <script>
remove() certain paragraph does not work
Lets start with an example webpage (german online magazin): https://www.heise.de/news/Reaktionen-zur-Great-Firewall-made-in-the-USA-4866141.html?view=print As you can see in the mid column pretty much at the end there is a section with picture and headline "LESEN SIE AUCH". I want to get rid of it all (after loading of webpage). Therefore I applied a script containing the following jQuery instruction: $("a-collapse").remove(); However it does not work. How else can I remove elements with own unique
what is are the differences between empty() and html(“”) in jquery
I noticed people using $("#div1").empty() to clear every thing inside the div, with attached events . and $("#div1").html("") to achieve the same. pls, tell me the difference between them or which one should be used.
My change event selector is not working anymore after an AJAX call?
Hello, I have an table which initial filled server sided with 300 rows or it can be even more. var strhtml = '<table id="table" class="">'; strhtml += '<tbody>'; strhtml += '<tr>'; strhtml += '<td><input type="checkbox" class="select" id="select_' + result.data[i].cmid + '" name="select_' + result.data[i].cmid + '" value="' + result.data[i].cmid + '"' + checked + '/></td>'; strhtml += '<td><input ... strhtml += '<td><input type="text" class="update" id="shnr_' + result.data[i].cmid + '" name="shnr_'
jQuery playPromise not working in script for audio on hover
As per this tutorial https://developers.google.com/web/updates/2016/03/play-returns-promise I'm trying to implement playPromise in my code. The reason: Google chrome policy changed and now autoplay is not working out of the box anymore. The instructions: A play() call on an a or element now returns a Promise. If playback succeeds, the Promise is fulfilled, and if playback fails, the Promise is rejected along with an error message explaining the failure. This lets you write intuitive code like the
how to send more than one record at a time using javascript to a wcf data service for updation
I have one WCF data service, now I want to use jquery to send set of records to wcf data service for updating at once, any link with an example would be more helpful. thank u
.ajax reports success status but runs the error method
Maybe I am doing something wrong, but this looks like a bug to me. I run the .ajax method show below: 50 $.ajax( 51 { 52 url:"ajax_setEmail_16.Chg", 53 type: 'POST', 54 dataType: 'json', 55 data: JSON.stringify(jem), 56 contentType: 'application/json', 57 mimeType: 'application/json', 58 success: gotEmailAddr16, 59 error: function(xhr, status, error){ 60
What use instead of the below jQuery Library? Android Play Developers Pre-launch report for APK :
What use instead of the below jQuery Library? Android Play Developers Pre-launch report for APK : The security section identifies issues found after checking your app’s APK file for known vulnerabilities. Vulnerable Libraries Detected in APK 20, 10 Your app contains one or more libraries with known security issues. Please see this Google Help Center article for details. Vulnerable JavaScript libraries: Name Version Known issues Identified files jquery 1.10.2 SNYK-npm:jquery:20110606 SNYK-npm:jquery:20150627
Dynamically populate the options of a select, from AJAX call, and add conditional the selected option?
Hello, I have an AJAX call created by changing the value of select element, and I get the response array with data to populate another select element. This itself is working for me now but I'm not convinced/satisfied how do this. This how I have realize it now: if (result.data[i].fsel) { jQuery('#'+flID) .append(jQuery("<option></option>") .attr("value", result.data[i].tlfc) .attr("selected", "selected") .text(result.data[i].tlfn); } else { jQuery('#'+flID)
How to Enable jQuery Each on Dynamically Added Content
Can you please take a look at this Demo and let me know why I am not able to use the $('.quantity').each(function() when adding the content dynamically to the document? As you can see the $('.quantity').each() is functioning properly when is hard coded but not working on dynamic content $('.quantity').each(function() { });
how to show the div on click of button while the processing in side the button click is going on.
i want to block the web page so that if i click save button, then while the save button is processing one should not be able to click on any other button and after the process of the click of save button is over then form should be available. Q1) how many ways this could be achieved. q2) following is the way i am using but it is not showing the div unless the processing of the loop finishes. <style> #popupblock { width: 100%; height: 100%; position:
Getting textarea value with line breaks
I have a textarea, and i am adding some text in it dynamically(with line breaks) that could look like this: a b c Now when i get the value of this textarea: var strInput = $('#myTextareaID').val(); It returns: 'abc' So without the line breaks. How can i get my text with line breaks or space between them, i need those lines individually. Thanks in advance.
live search jquery and show to the table
hello, i'm creating live search and show it to the table here the ajax $("#cari").on('keyup', function(){ var cari = $("#cari").val(); $.ajax({ type: "post", url: "do_kasircari.php", data : {cari: cari}, dataType: "text", success: function(data) { $("#hasil").load(data); console.log(cari); console.log(data);
I'm trying to create an XML-file from the values in the input fields, but gets error message
I'm trying to create an XML-file of the values from the input fields: https://jsfiddle.net/8w1rb9d4/1/ But I'm getting the error message: "Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'.". The error message doesn't show very well in JSFiddle because of the text almost has the same color as the background. So what could be wrong? Is there more to it than what is already in the code? Am I missing something?
Concatenating two input fields into one hidden field and passing on form submit
I got a request to send full-name when a form is submitted. The form gathers first-name and last-name and I just need to concatenate them and submit it in a hidden form field. Here's what I have so far for something that should be simple, but I'm missing something here: <input name="firstName" id="firstName" type="text"> <input name="lastName" id="lastName" type="text"> <input name="fullName" id="fullName" value="" type="hidden"> $("#new-user").submit(function(event){ var fName = firstName.val();
Hide fixed div when scrolling over another div
I am trying to use Jquery to hide a fixed position div .wp-fixed (always shown at the bottom of screen) anytime the user scrolls over another div .wp-over (i.e. when .wp-fixed is within the .outerheight of .wp-over)? Not sure how to approach this. any help would be much appreciated
Changing CSS in iframe with jQuery
Hello, i want to change the CSS of an iframe (iframe content comes from the same domain but the iframe should be displayed a little differently, which is why I cannot change the CSS on the main page) as easily as possible using jquery? The code should also work if the iframe is lazy loaded. The following code doesn´t work for me (without lazy load and with lazy load): <script>$("iframe").contents().find("#Anker-PowerCore-10000mAh").css("display", "none");</script> #Anker-PowerCore-10000mAh is the
Is there any way to put google sheet data into HTML div?
I want to combine google sheet with my website. My idea is when I update data in my published google sheet, the HTML div tag with a certain id (the content of divID column in my sheet) will automatically fill in the data to it. For example, So, if I create a div with id="K800",the model number, like <div id="K800"></div>, then it will fill in a <p> with the data into the div, just like this: <div id="K800"> <p>Model Number: K800 Product Name: Large Gripper Manufacturer: Niryear</p> </div>
when and where i should use const.
hi, Q1) i want to use const of javascript and let with jquery 1.9 on my page , can I use it? Q2) I have more than one js file on my aspx page, what I have noticed is that in each js file , I have some variables which are declared with var but they are nothing but abbreviation(which are not changed). so can I make them const?
How to hide version information of JQuery in generated web response?
I see the version information of JQuery, is being rendered in the web response. Is there a way to hide it? Hackers can easily exploit the app by knowing the problems with specific version.
Dynamic File Upload - Is this possible?
Hi, I am attempting to customize a shopify website that sells custom mugs/cups. A user can customize their mug by choosing various preset options and text input fields. When they have completed the customization there is a button for them to generate a preview of the mug. The problem I am trying to solve is that at the moment the image doesn't get submitted to the cart. So, I have added a file input object to the form. But it currently has the "Upload File" button. Instead of allowing the user to
cannot get data from ajax
hello i was creating live username check for learning here my code login.php $.ajax({ url: "cek_username.php", type: "post", data: "username="+username, success: function(data){ if(data == 0) { $("#idErr").html("username tersedia"); $("#id_daftar").css("outline-color","green"); } else {
how can i pause video when switch tab or minimized the browser?
how can i pause video when switch tab or minimized the browser?
Loaded Click Event
I am using ajax to load html code snippet containing links (id = "edit") into a main class = "container". The problem is that I can't fire the loaded link event, here's the example: code : html + html loaded : <main class="container"> <div class="profile row"> ... <table> ... <a id="edit">...</a> code : jquery : $ (document) .ready (function () { $ ("# edit"). click (function () { alerta ("Johnny"); }); });
change the background color of class
How to make that when you click on class fon of box1, the background color of class sun of box1 must to changes, and when you click on class fon of box2, the background color of class sun of box 2 must to changes. At the moment, the background color of boxes 1 and 2 is changing, although only click on one of the boxes. <style> .container { display: flex; } .sun{ margin-top: -6rem; margin-left: auto; margin-right: auto; width: 10rem; height: 14rem;
is there any comman event or function which can detect error of the page at one place.
hi, in asp.net i noticed that there is an event which can capture all errors at one place. u do not have to put try catch at all the places. similarly if i am using jquery , is there any event or functionality which can give me this facility.
Ideas how to ROTATE (2) images Simultaneously from one slider?
Hi everyone, I'm trying to work with Jquery to have (2) images, the same image actually, side by side abutting each other with a slider control for rotate and scale where changing the value of either slider will cause both images to respond simultaneously. I'm working from a project called ImageEditor, with the code I've modified already from it below. From what I can tell being totally new to JQuery, I need to get this line of code: oninput="editor.rotateImage(this.value);" to not just control "editor"
hide banner from screen
Hi please help, I am trying to hide a banner on my page see line 6 below my code is getting into the else but it's not hiding the banner var covidId = $(".covid-popup").attr('id'); //POPUP ONLY ONCE if(localStorage.getItem('popState') != 'shown'){ $('#'+ covidId +'').show(); } else { $('#'+ covidId +'').hide(); }
jQuery ajax - best practice
I've been using jQuery ajax to load contents onto my website via events for a while. Is this still the best approach or should I be using something like fetch to do this? fetch appears to only use json and my content pages are html pages.
html(response) not working
I have success: function (response) { jQuery("#message_" + Update_Parts[1]).html(response).fadeOut('slow'); }, As part of an Ajax call jQuery("#message_" + Update_Parts[1]).html(response).fadeOut('slow'); Works the first time but not if I click the button again without refreshing the page The ajax works but I don't get a message showing. It is as thought "#message_" + Update_Parts[1] doesn't exist after the first time. What am I doing
Using ajax to retrieve http response codes from list of urls
Hi, I am looking for a script (or help with a script) that would allow me to test whether or not a list of urls are valid (Status code 200 etc). Preferably I would like to use a php script to make a number of ajax calls from within a loop passing the url to be checked to an ajax function which in turn returns the status code back to the php script. I don't have a problem with the php side of things, but I am at a loss with the ajax functions. Everything I have managed to find either doesn't work
Best way for creating html pages with Jquery?
Hi I am thinking about the best solution for filling рtml template with Data from API(json). For example, my API returns 100 rows of comments. how its better to insert in template? One-by-one groing through each row of json array add insert in html? Or create entire HTML element in Jquery and insert in HTML entire HTML code? Maybe there is some best practice on how to work with Html templates + API(json) Thanks a lot!
I need to save my selected option in localstorage
I need to save my selected option in localstorage. When i refresh my page, the last selected option will be marked.
which method is fast and safe to get data- attribtes value
hi i can get the data attribute using following pls tel me which one is fast and safe . specally i want to know that the jquery method the third one will tervers the whole dom to find the element or it will just convert the element's object into jquery and would get the data- attributes vlaue? the obj is a variable where i have passed the this key word onclick="fun(this.getAttribute('data-uid') and inside function fun i have used all three ways to get the value of data-uid 1) var uid= obj.getAttribute('data-uid')
how to add input fields and dropdown and sub drop down by click on button using javascript or jquery
I am trying to add input fields and one dropdown by click on button,one more thing is if I select dropdown value another sub dropdown should show based on the selected value of first dropdown. https://jsfiddle.net/xbf2vryc/ I was trying to add fields it has done and remove also happening and sub dropdown is not happening. in that case if select test1 sub drop down is coming like test11,test12, then when select second row field test2 it is coming test21,test22 sub dropdown but first row test11,test12 sub
Next Page