how to pass variable to $('xxx'').click(function () {
I'm trying to pass a variable to .click function I have defined a var navFlag="home" $('.nav').click(function (navFlag) { alert("nav under construction - navFlag .. "+navFlag); }); // nav navFlag is returned as [object Object] What is the proper way to do this? Thanks for any help, R
.load transform to .ajax
I can't understand .ajax!!! Can someone help me this(.load) transform to (.ajax) var max = 5; var clicked = 0; var add = 0; $('#art-load-posts').click(function() { clicked++; var nextLink = clicked + 1; var add = clicked; if (nextLink <= max) { $('.none').before('<div id="artcontainer" class="pbd-alp-placeholder-'+ add +' artcontainer"></div>'); $('.pbd-alp-placeholder-'+ add).load('page/'+ nextLink
Return values of scrollTop()?
Related StackOverflow question. A user on the SO forums asked about the return values inside jQuery's scrollTop(value). Because the documentation does not specify what this would be I thought they made an error. However, upon investigation I found that the second returned item is the current scrollTop position. But I can't figure out what the first is. You can see in the code example here that when scrolling the first value is always zero, the second is the current scrollTop. 1. What is the first
Not able to change the format of date in the datepicker
I am using the below datepicker but I am not able to change the format of the date. $(document).ready(function() { $(document).on('click', '#mdateupto', function () { $("#mdateupto").datepicker( "option", "dateFormat","yyyy-mm-dd"); $(this).datepicker().datepicker( "show" ); }); }); Please help Regards Deepak Bhatia
Javascript to generate a 5-digit fixed length random number ???
Hi, I'm using K2 Smartforms, where you can embed Jquery/javascript in data labels using expressions. Can anyone help me create some jquery/javascript which can generate a RANDOM number which is of a fixed length of 5 i.e between 10000 and 99999 Thanks, I tried this code which I found to work ok with the data label, but this generates random number continually, is there any way to modify it to work as I want? < span id="number"></span> < script language="javascript"> function generate() { $('#number').text(Math.floor(Math.random()
why jquery $.ajax success not working in safari mac?
why jquery $.ajax success not working in safari mac? this is my code, $(window).load(function () { $.get("GetFirstTimeWizardStep", function(step) { if (parseInt(step) === 2) { $.get("/api/DisplayView?viewId=afe8cdd4f", function (flagView) { if (flagView === "False") { $("#afe8cdd4-e7a0-4577-9e53-322d5a3d8bbf").modal("show"); $.ajax({
JQuery click event re-firing is not working in IE
Running IE 11.0.9600.18524. I have a function which stops the default click event, performs some actions, and then after those actions are finished, triggers the event again to proceed with the form submission: $('#submit').on('click', function(event){ if (valid === true) { valid = false; return; } event.preventDefault(); valid = true; //do some stuff $(this).trigger('click'); }); This works nicely in Chrome, all of the form actions complete and then the button
code not working neither getting any error
I am not getting any error neither the code is working, whats wrong in my code? <!DOCTYPE html> <html> <head> <title>Radio button and List Check</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" > $("#country").change(function() { var country = $(this).val() var currency = { USD: "USD", EUR: "EUR", GBP: "GBP" }[country] console.log(country, currency) if (currency) $("[name=optradio][value='" + currency + "']").prop("checked",
Changing the val name without refreshing the page.
Page contain input bar for which user can type in certain numbers and submit. Without refreshing the page I would like to change the "var Name" below according to the user input instead of the current datetime. Thank you very much!
Correct way to handle .then continuation
I have a .then continuation that should either call another asynchronous function or not do anything. What is the correct way to write the function? Here it is: function loadCategories(shortDescription, categoryId, index) { return categoryService.loadChildCategories(shortDescription, categoryId, index) .then(function (result) { return categoryService.prefetchChildren(shortDescription, result, index + 1); }); } I want to call prefetchChildren
find classname fails
I've spent quite a bit of time debugging this. Anyone notice a problem? It cannot find the class toggledata. Looks like it should. <div id='div_76' class='tasks topdog' style='border:solid; border-color:red;white-space:nowrap;background:#cfecf0'> <div class='tasks toggleplusminus' style='background:#cfecf0'> <span style='font-size:12px'>[+]</span> <input id='cccproj_76' data-projid='76' data-selected='1' data-pri='50' data-cat='WORK' data-owner='frank' title='WORK' value='Test "This"' style='border:none;background:#cfecf0;color:black'
tree plugin with breadcrumb trail
I wish to build a UI where the user can navigate a tree such that: (i) The children (aka leaves) of the currently-navigated-to node in the tree are all displayed in a single <ol> (or similar) list (ii) Clicking on one of the entries in the aforementioned <ol> will navigate the user down a level and display the new list of children where the old list was (iii) Navigation upwards, and information about where the user is in the tree, are provided by a "breadcrumb trail". Does anyone know if a jQuery
How to drag multiple cells of a table , into multiple items of another table , where each cell of a table is connected respectively with each cell of the other table?
I want to select multiple cells of a table A and drag them into the respective cells of the table B. When I drop them I want that the cells of table B to change class into " dropped". So each cell I dragged is connected with the cell of table B ,where it is dropped.
Having Issue On Selectiong a Dom Target with jQuery Traversing
I am trying to update the content of .help-block dynamically with using jQuery but not sure why I am not able to target the .help-block I know that we can simply use $('.help-block').text(....but as I said I need to do this through jQuery Traversing mechanism like using following find() or next() and first() but none of them did the job! $(function(){ $(".dropdown-menu li a").click(function(){ $("#selector").find('.help-block').html($(this).text()); $("#selector").next('.help-block').html($(this).text());
Recovering data from a joined string
I have a "canvas" div full of HTML, where 'canvas' here has nothing to do with an html 'canvas'. I want pack up everything relevant to div#canvas and store it as a single file, and then later read the file back and restore div#canvas as it was. I pack up the canvas styles with canvas$ = $('#canvas'); // the local canvas being saved var canvas_margin_top = canvas$.css('margin-top'); var canvas_margin_bottom = canvas$.css('margin-bottom'); var canvas_margin_left = canvas$.width()/2 +
Google Maps API
Hi, I am trying to get a google map to display. I have 3 files. HTML, JS and CSS. The map will not load. Can anyone point out where I went wrong with my code? Thank you Html: <!DOCTYPE html> <html><head> <meta charset="utf-8" /> <link type="text/css" href="map.css" rel="stylesheet" /> <script src="https://maps.googleapis.com/maps/api/js?callback=myMap"></script> <script type="text/javascript" src="map.js"</script> <title>My First Map</title> </head> <body> <h2 align="center">My First Google Map</h2>
Form submits when input is null
I want to prevent form submission when there is no input in the text boxes but the form submits even when the input is empty. How do I fix this? var input = $("#zip").val(); var input1 = $("#phone").val(); if ( $.trim(input).length == 0 || $.trim(input1).length == 0 ){ event.preventDefault(); } <input type="text" size="30" id="zip" name="zip"><br /> <input type="text" size="30" id="phone" name="phone">
want to click an application link
Hi All, we have a requirement where i need to click some link of one application .can we do this any batch file or script through which we trigger that application will click the link . Any idea on this? Thanks, Rohit
Multiple selectbox using jQuery
I am developing a python/django app and I have this form where I have two multiple select boxes. And I want to select an option from the left and move it to the right. I have two only to be more firendly tothe user. The selected options that are being saved are to the left select box. You will see to the following code how, I think it's very simple. I am using .each, because I somehow loop...but my code, I think, at each click repeats itself and keeps only the last one I have selected. I came to
Help-me problem array
my array is returned php this form: Array
(
[0] => Array
(
[Sua senha deve ser maior que 4 caracteres e menor que 20] => 1
)
[1] => Array
(
[O email lucasabner07@hotmail.com já está cadastrado no sistema. Se você for ... clique aqui. Se não tente um outro email] => 1
)
) My objective is Manipulate this array to use the key as message and value as the message type, if it is 1 an action if another action. And main array I want to use
jQuery ajax API call with JSONP data type is failing
down votefavorite I am building client application( using Jquery and HTML but no server side language) to access API call publish by NPPES website- https://npiregistry.cms.hhs.gov/registry/API-Examples I am using JSONP data types to avoid same origin policy in browser call but Ajax call is giving error and don't go to success callback. e.g I am trying to call this : https://npiregistry.cms.hhs.gov/api?number=1073500443 ( if i directly invoke this in browser it gives json data back $(document).ready(function(){
Uncaught TypeError: $(...).datepicker is not a function
hi here is my code. I want to choose a date and the other will automatically give me 2months later date. its shows me this error "Uncaught TypeError: $(...).datepicker is not a function" <!DOCTYPE html> <html> <head> <title>Date Choose Option</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> </head> <body> <input type="text" class="firstcal"> <input type="text" class="secondcal"> <script> $(function() { $(".firstcal").datepicker({
Uncaught ReferenceError: $ is not defined
hi I tried to execute this code but its not working.... here is the code. <!DOCTYPE html> <html> <head> <title>Testing Dropbox</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> </head> <body> <div> <textarea class="carPark"></textarea> </div> <div> <select class="carDealer"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option>
Password validation
Why doesn't my password validation work? http://plnkr.co/edit/h60lRLZDEYxXa1TaJoro?p=preview
persist dropdown selected value not working
see below fiddle for my jquery code, let me know what is wrong with it. thanks. https://jsfiddle.net/rh8dqas5/5/
Get input value with Jquery and add it to form action before post it
I tried already on stackoverflow - no answer :(. I have unknown many Forms and unknown many different values on my site. Thats why i would send all necessary data over the action and use it with $_GET['up'] . I have an input field wich i would send with my form too (value is given by the user). How can I get this value with jquery and add this to my action ? I tried already like above, but got errors like "Jquery not defined" or "Unexpected token <" ... I´m very bad with jquery, sorry. <form action="/de/site.html/index.php?up='.$sell['Name'].','.$sell['street'].',1,<script>$(\'.'.$a.'months1\').html(months)</script>"
How to move an element one level up?
Assume I have the following HTML source code <div class="foobar" ....>... <picture ...>.... <img ....> ...</img> ....</picture> ...</div> How can I extract the <img> element and move it one level up just before (resp. after) the <picture> element? This procedure should be done for all <img> below the enclosing <div class="foobar"> but not for the <img>s outside. Thank you Peter
removeClass & addClass not working
remove & addClass functions do not work. I am trying trying to make sure that the span class changes to a new one once it is clicked. here's the jquery code: $('.vote_btn').click(function(){ $.ajax({ url:'/joseph/pages/votes.php', type: 'post', //dataType:'json', data:{'comment_id':$(this).data('commentid')}, success: function(data){ if(data == 'up'){ $(this).removeClass('fa-thumbs-o-up').addClass('fa-thumbs-up');
Dynamic <select> - How to deal with?
Hi, I have employee evaluation for and it's populating the data from database and for every element of the evaluation there is a <select> to choose the employee rating. I want to know how can I implement this? I need to show the first question and when the user selects from the dropdown then only it will show the next question until last? How to name the <select>? will all have same name? here is my code: <table data-role="table" id="movie-table" data-mode="reflow" class="ui-body-d ui-shadow table-stripe
On event press Enter button call function
Could someone help me with the following line, it seems to make sense but when I press enter it doesnt call the serviceCall fucntion <div id="buttonSubmit" onclick="serviceCall();" onKeyDown="if(event.keyCode==13) serviceCall();">SUBMIT</div>
jquery ajax external url calling and json response problem
i want to get json response from this url:'https://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/ajaxGetQuoteJSON.jsp?symbol=tatasteel'using jquery ajax.it gives undefined response and goes error function. but browser debugger shows response and 200 ok status code.
How to multiply 2 columns in html table using jquery
Hi following is my html table <table id="grdtable"> <tr><td>Charge</td><td>start</td><td>End</td><td>No</td><td>Total</td></tr> <tr><td>7</td><td>100</td><td>200</td><td>100</td><td>700</td></tr> <tr><td>8</td><td>10</td><td>100</td><td>90</td><td>720</td></tr> <tr><td>9</td><td>20</td><td>50</td><td>30</td><td>270</td></tr> </table> ts output is as follows Charge start End No Total 7 100 200 100 700 8 10 100 90 720 9
How do I link to external js in this case?
Hi, if anyone can help me out with this, i would be really thankful. Basically, try to call external js that has EncodeSearchTerm function, because the external JS's EncodeSearchTerm function will be changed constantly by someone, so instead of going to change my js EncodeSearchTerm again, is there way to seamless integrate based on external js file? Let say, my JS file is myjs.js, and the external js is othersource.js Following are the myjs.js as an example: $("form.rm-search-form").submit(function(event)
Unexpected behavior from append()
I want to add some elements when a button is pressed, but have strange results: I set up a fiddle here: https://jsfiddle.net/vn65g5ve/3/ 1) Why is it saying add_room() is not defined? This is of course not related to the question per say 2) Why is the text in the inspector coming up as "Price", "type: " etc ? So why the double quotes? This seems to be because a text node was appended, and again not really related to the main issue, which is: 3) Why is the appended code not interpreted as HTML? Seems
Variable and div in place of selector
Dear everyone, I've been using jQuery UI Dialog to setup confirmation messages as follows: $('<p> Are you sure you want to remove user XX from your contact list? </p>').dialog({ But now I need to be able to display the real name of the user instead of "XX". I have this example variable : var name = 'John' ; that I need to insert it in place of "XX". Later on, I will pass variables from my Drupal module, but I need first to know how to insert the variable "name" in place of "XX". Can someone help
Persist all posting or changes
I just got checkbox checked/unchecked persist to work. Then i realized all the events i coded through jquery will have to be persisted as well, like hiding certain table rows by checking checkbox, or options selected through dropdown list, all these info will need to be persist, is there a universal way to persist all the jquery events, or do i need to code separately for each event? do i need any plugin for it? like jquery cookie?
Change radio button style
Hi , I would like to make the radio button check boxes on this page of my site larger and if possible with lime green colored check marks. I think it would look more attractive for the type of site I'm trying to create. I have no idea where to start with this. I would really appreciate some help please. The page: http://10meijin.com/babynames @extends('layouts.bg') @section('content') <div id="middle" class="full_width"> <div class="container clearfix"> <div id="mid_bird"></div>
Code to persist checkbox
I am trying to persist checkbox (when it is clicked, it will show as clicked, vice versa). This is the code i found online but doesn't work. Can you tell what is wrong with it? Or is there better code? var checkboxValues = JSON.parse(localStorage.getItem('checkboxValues')) || {},
$checkboxes = $("input :checkbox");
$checkboxes.on("change", function(){
$checkboxes.each(function(){
checkboxValues[this.id] = this.checked;
});
localStorage.setItem("checkboxValues", JSON.stringify(checkboxValues));
hide table row upon combo selection on two dropdown lists
I tried to hide certain table rows upon selection of certain combo values on dropdown lists. for example, if user choose "combat" in option1 and "skill" in option 2, then certain table row will hide. it doesn't work. see my code in https://jsfiddle.net/rh8dqas5/1/ what should be the correct code?
Sorting an array but only for values above zero?
If I have an array, myArray = new Array(0,1,8,3,4,10,0,0,0); how can I sort it so I have this as result; myArray = new Array(1,8,3,4,10,0,0,0,0); With the '0s' at the end of the array rather than the start. I have tried may ways but keep getting stuck. Thanks in advance;
Next Page