How can I make this small "for loop" better ?
Hello, I'm about to deploy a website but I'm stuck in this last thing I hope I could get help! So, I'm trying to make this for loop better.. and by better I mean I want to be able to call the function from outside the for loop. But since I have 6 buttons I need the i++ to get a different index for each button so I don't know what to do. I just need to be able to call the function called "my_function" else where but I can't, the only way I can make my for loop and function work is as the following.
Check allconditions before executing aftermath.
I am working on a live validation function. The problem is that the aftermath of the conditions in the function executes executes before the last part is met. The entry validation indicator should not turn green until the conditions are met, however this is not the case. The indicator turns green after the third condition is met. It should not, until all conditions are met. Any suggestions on how I can solve this problem. Code is on Fiddle
hasClass keeps returning false
Hi guys, i'm having a slight issue with my code. The hasClass method seems to return false always, even if the class name matches. Here is the js code; let classAttr = $(this).hasClass("delete"); console.log(classAttr); if (classAttr) { // Do something } else { // Do something else } Your response will be appreciated. Cheers!!
I am stuck on this plz help me
I have three divs having same id <div id=“1”>Click me</div> <div id=“1”>Click me</div> <div id=“1”>Click me</div> I want to hide only which i clicked but when i click on any one all the divs hide. $(document).ready(function(){ $(‘[id=“1”]’).click(function(){ $(‘[id=“1”]’).hide(); }); }); I want to hide only that whick i clicked
I need to check for 5 years of history using jQuery.
Hello jQuery gurus. I'm currently developing a form where our clients are filling out their home and employment address information and I need to check their "from" and "to" dates to see if they're giving us 5 years of address history. I know there have been similar questions asked on here before, but I can't seem to get anything to work for me. So here's my code that I have so far. $("#EmploymentHistoryStartDate").blur(function () { //just using .blur for now for testing purposes. var startDate
Click Event on a class does not trigger when the class is added to the DOM by JQuery
Hi! Code to Test: https://jsfiddle.net/p71L136h/ Need: Add some Link with JQuery to send later to a iframe I have some "<a>" tags with a class "ToFrame" in my html code. When i "click" on thoses link a event is fired so i can send the "href" to the frame. BUT When i "Add" new links (with the class) from JQuery nothing is fired and the Url is directly loaded in the browser (!) I make a little sample to show the problem: https://jsfiddle.net/p71L136h/ Thanks a lot to explain me why this don't work,
How to call a javascript function which is inside a jquery function?
Below is the structure $.fn.CreatePayment= function() { ...... function overpay(money){ } }; How do I invoke the overpay function ?? Appreciate help on this
trying to get ajax request to work
function loadPages() { var url = "/api/ChartAPI"; $.ajax({ url: url, type: "GET" }).done(function (resp) { //Get the number of pages. //Consider here the page size as 10 var pgSize = resp.length / 10; //If the Result is float, then Round it to 1 if (isPgSizeFloat(pgSize)) { pgSize = Math.round(pgSize); }
How to open a model on click of an anchor tag?
I'm trying to display a modal on the click of an anchor tag. I have dynamically created anchor tags (within a table and divs), on click of which a modal should be displayed... <a href = "#close" class='forum-title' name = "abc">XYZ</a> I've given the "#close" randomly (to prevent it from throwing an error..guessing it's(href) not imp in this case...) I have given a simple function on the click function of the anchor tag : function openModal() { $('#usermodal').modal('show'); } Please check my JSFiddle
jquery split variable values in array
I have a div with an ID of '#Main" and I am trying to change CSS classes for this div with a collection of variables. using + ' ' + seems to add lots of empty space between classes therefore I was trying to use the split property but so far I am unable to do so. It will be very kind of you friends to kindly solve my issue. My code is as below; jQuery var MainClasses =""; var BackgroundColor=""; var BackgroundPattern =""; var TxtColor=""; // Some code & conditions here which is assigning
Not able to set type attribute in IE8 with( WS2008R2 - IIS 7 ) configuration
we are facing issue while trying to set the "type" attribute for a input element in IE8 with the machine configuration ( WS2008R2 - IIS 7). $("<input id='main'></input>").attr("type","text") Issue : "This comment is not supported"
what's wrong with this ajax() function?
What's wrong with this ajax function?: <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"> $.ajax({ url:"https://www.test/api/GetBalance" }) .done(function{ alert('balance retrieved'); }) .fail(function{ alert('error!!!'); }); </script> I haven't used the jquery ajax() function for years. The code above isn't returning an error to the console and it isn't displaying one of the alerts either
problem with multiplication variables from input
i have this code i need to insert one value in the first input and auto calculate in the second and third input <input type="text" name="markup" id="markup"> <input type="text" name="mark" id="mark"> <input type="text" name="marknet" id="marknet"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ var item1=$("#markup").val() / 100 ; var item2=$("#mark").val(); var item3=item1 * item2; var item4=item3 + item2; $("#markup").change(function(){
Call .net web service from php and set cookiecontainer
I called this web service from .net. this is my code: CertClientWS ec { get { if (Session["CertClientWS_WS_Localhost"] == null) { CertClientWS _ec = new CertClientWS(); _ec.CookieContainer = new CookieContainer(); Session["CertClientWS_WS_Localhost"] = _ec; _ec.Timeout = 400000; } return (CertClientWS)Session["CertClientWS_WS_Localhost"]; } set { Session["CertClientWS_WS_Localhost"] = value; } } But Now i want to call this web service from php code. How can i write this code i n php? I can't set
Some jQuery functions working on one WordPress page and not working on other WP page of same multilanguage site
Hi, I have a strange problem on a WordPress site and after hours of searching I am unable to find a solution: A jQuery script (yes, I use wp_enqueue_script and everything is loaded correctly) does what it is supposed to do on the English page but does not work on the German page as can be seen here: http://dev.lindabra.com/lindabra --> click on button "Find my size" / "Meine Größe finden" . On the English page all the necessary buttons are created (with jQuery append() function) and the input
How to highlight html map area tag when is set some coords?
Hi all, I have a picture and to this set some areas ... but How to highlight map area tag when mose hover? Thank you!
Submit was fired multiple times
Hi, I am working on building a div where people can drag and drop files in the box. The code will upload it to the server automatically. I am trying to understand the cause of malfunctioning of the following code. The pink background bold blue color font part of the code was fired 8 thousand times. Can you help me understand this? also, how I can get it fire only once? Thank you! Jing Jing ----------------------------------------------------------------------------------------------------------------------------------------
My local machine (PC) browser doesn't show jQuery! Pls help me!
Hi all, This is my code. HTML: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Pixel Art Maker!</title> <!--<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Monoton"> <link rel="stylesheet" href="styles.css">--> <script src="jquery-3.2.1.min.js"></script> <script src="designs.js"></script> </head> <body> <h1>Lab: Pixel Art Maker</h1> <h2>Choose Grid Size</h2> <form id="sizePicker"> <b>Grid Height:</b> <input type="number"
JQuery Notification event does not get fired.
Hi, I'm trying to add a notification using JQuery when clicked on a button. <input type="submit" runat="server" id="submit_click" name="submit" value="Submit" class="btn btn-success"/>Associated event should get fired by this : $('#submit_click').click(function() But it does not... I've also tried giving, $('body').on('click', '#submit_click', function (e) {...........}); Please check the below JSFiddle: JSFiddle : https://jsfiddle.net/tj5a5bnk/17/
Flicking problem when providing position absolute using Jquery
https://test-ridersdeluxe.myshopify.com/collections/ridebukser. Here is my test site. Please let me know how I can solve this problem,
Querystring - Add value to specific variable
Hi, I have this script, it passes the querystring to the next page if you click an <a href> And it adds the value "10". The problem is that it adds "10" to the last value. I want it to add 10 to just the value I want. Example: www.mypage.com?test=123&hello=321 How would I do it if I just wanted the "10" on the test variable (but only if variable "test" exist) so it would turn out to: www.mypage.com?test=12310&hello=321 Apprecite any help, thanks // Daniel My script: $('a').attr('href', function (index, value)
Jquery .append list not working
Hello Guys, I have an issue with my jquery and I cant seem to figure it out So I have a home.jsp file and I have two include statements I'm including quicklinks,jsp and activity.jsp In my quicklinks.jsp file i have the following and it displays a list as it should <div class="headertxt">Quick Links</div> <hr> <script> var options = [ { "href": "something1.jsp", "text": "My linktext1" }, { "href": "something1.jsp", "text": "My linktext12" }, { "href": "something3.jsp", "text":
How Do I Fix MY Broken Timer
I am working on a tabata timer but as soon as I tried to put a "rounds" feature in it broke as well as the reset button. SOS. HELP. Below is my code: HTML <head> <!--outside libraries/functionality --> <link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type="text/css"> <audio id="buzzer" src=></audio> </audio> <type="audio/mpeg"></audio> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script type="text/javascript"
Error message doesn't disappear when error occurred second time.
Having the flowing jQuery function: function ClusionSuccess(result) { if (result.success) { reloadById(); } else { $("#errMsg").text(result.errorMessage) .fadeIn('slow') .delay(3000) .fadeOut('slow') .queue(function () { $("#btnAddClusion").prop("disabled", false) }); } } So when the else statement is hit first time, the error message appears, stays 3 seconds, fade out
jquery custom thumbnails slider images not sliding?
Hello All, in my code the slider is not working for all resolutions, Mainly not working in mobile screens. I want that my thumbnails images should move like: http://preview.codecanyon.net/item/lightweight-ecommerce-product-jquery-plugin-ubislider/full_screen_preview/18707690 Example 1 | Horizontal Here is the code: jQuery(".ulwrp").css('width',(jQuery(".small-img-li li").length*jQuery(".small-img-li li").width())+50); var h= jQuery(window).height(); // New height var w = jQuery(window).width();
jQuery Plugin for Circular Text Problem !!!!!!!!
Hi I'm trying to set my text in circle form using "jquery.lettering.js" & "circletype.min.js".. here's my code : <html> <head> <title>Document sans nom</title> <link href="css/style.css" rel="stylesheet"> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.lettering.js"></script> <script type="text/javascript" src="js/circletype.min.js"></script> </head> <body> <div id="text"> Amal Ben Jannet </div> <script> $('#text').CircleType({position:
How to change image on dynamic checkboxes?
Hi, I'm new to JQuery and would really appreciate some help! I have dynamic checkboxes which has an icon and image on it (checkbox is hidden)... plcUserReq.Controls.Add(new LiteralControl(" <div data-toggle='buttons' style='margin-top:-3px'> <label class='btn' for='Lines' style='padding:0px 0px 0px 0px; margin:0px 0px 0px 0px'> <input type='checkbox' autocomplete='off' name='chkbx' value='" + UID.ToString() + "'id='chk'"+ UID.ToString() + i.ToString() +"/> <i class='btn
selector instanceof jQuery,return itself
Can i do this, add a judge, when selector is instanceof jQuery,return identical. Will it cause some bug in some situation? Thanks for anyone reply. jQuery = function( selector, context ) { // add this return --> if(selector instanceof jQuery){ return selector; } // <-- return new jQuery.fn.init( selector, context ); },
What does this mean?
I have been gone from JQuery for a long time and it seems now my mind is blank. I've inherited an app and it breaks on this line: var checkedRadioButtons = $('#form1 .rbl input:checked'); It says JavaScript runtime error: Object Expected I'm lost here. Can anyone tell me what may be going on?
Resetting all dropdown lists inside a div
I am developing an ASP.net application that includes several modal popup forms. Each of these contains several textboxes, some hidden fields, some checkboxes and one or two dropdown lists, and before any of these popups are displayed, I need to clear any data that may have been previously entered into these controls. I have previously had a separate javascript function for clearing each of these popups which accessed each control by name and then set it to the desired default value. This works
What is required from the script, and webpage, to load a website - before showing any content?
Websites nowadays are loaded before they open. This is either done with a progress bar, or a logo that pulses and then reveals when the webpage is ready. My question is how do you 'load' a website. I have heard of Ajax Load and Barba.js but as I am starting out, these topics (Barba.js) are difficult to grasp. I just wanted to check that this was the way forward for such a thing. I did try Googling it, thinking someone would have asked that before, but all the results contain is just how to make
getting the id of "any" html element using jquery
i need the get the element of "any" html element which is unknown using Jquery. is it possible? i tried this `var currentId = $(this).attr('id');`
Dialog box with multiple buttons
Hi in my website i am using a vbscript like below to display message boxes execScript('n = msgbox("'+str+'","35")', "vbscript"); which will display a message box with two button 'Yes' and 'No', there is another line like below execScript('n = msgbox("'+str+'","4132")', "vbscript"); which will display message box with three buttons 'Yes','No' and 'Cancel' and we are using iframes in our website is there any jQuery plugin available for the above
How to loop scroll event
My question is probably very easy. How to loop this function? Now, scroll event works only once. I'm looking for solution how to enable else function (smooth scroll goes from red div to blue div) Here is js code: var o = true; if (o === true) { $('div').scroll(function () { if(o){ $('div').animate({ scrollTop: $("#red").offset().top }, 1000); o=false; } }); } else { $('div').scroll(function () { if(o === false ){ $('div').animate({ scrollTop: $("#blue").offset().top }, 1000); o=true; document.write(o);
Trigger JS ajax function in just one element with same class name as others?
Hello people, I've been getting crazier day after day with this, I hope I could get help. So, I have a php file inside a php while loop that makes that file repeat 6 times (let's call them divs)... And then I have an ajax call (JSON) function that I call every time I click a button of that file, but I get the ajax JSON render in the whole 6 divs, instead of rendering on each div only when I click it's button. $('.trigger_button_inside_divs').click(RUN_AJAX_FUNCTION); I manage everything with classes
How to fix jquery "appendTo:" issue?
I have created aspx page, this page has one jquery dialog and Homepage link button.Before open dialog link button(click) is working, after open and close dialog link button click is not working,no action. In the dialog box dropdownlist added, it shows text comments from server as per selected items. I have found the issue in the jquery dialog is "appendTo:", when i comment this line then link button click is working but dropdownlist action not working[again its reset to the original position]. I
is conditionally preventing the form submit event a race condition ?
I have the following submit code for my form: // Form submit code $('#gform_wrapper_1 form').submit(function(e){ var FormErrorFlag = false; $('.gform_body .form-error').remove(); objCheckFormInputs = { 1 : validateAlpha($('.gform_body > ul > li').eq(1).find('input').val()), 2 : validateAlpha($('.gform_body > ul > li').eq(2).find('input').val()), 3: isEmpty($('.gform_body > ul > li').eq(3).find('input').val()),
calender is not working
i m using below code to open calender but its not popup .let me share code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>MagicCity | Support</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="~/Content/css/style.css?v=1.1" rel="stylesheet" /> <link href="~/Content/css/coin-slider.css?v=1.1" rel="stylesheet" />
jQuery: Executes properly after second call
In this code: $('#modal-action-store').on('shown.bs.modal', function () {
if (wasclicked == 1) {
var items = "<option value='0'>-- Seleccione Distrito --</option>";
$('#DistrictID').html(items); The query defines the variable items and then it will try to assign that value to the #DistrictID element. The problem: The first time the modal window is opened the code does not execute properly. This happens, I think, because the code is executing when
How do you acheive a constant smooth mousewheel page scroll?
Hello there, I was wondering if someone could point me in the right direction. A lot of sites nowadays use this 'smooth scrolling' effect. When you Google this, to try and find out how to do it, you are left with how to scroll between A and B. Similar to the 'up' arrow that appears to scroll you to the top of the page. However these sites:- https://gwbi.org/education/ http://www.buildinamsterdam.com/case/see-buy-fly Use a constant smooth scroll. There has to be a plugin for such an effect but I have
Next Page