Results are different per browser
I have tried this code in IE, FireFox, and Chrome and get three different results and do not know why. Here is a link to the page for a live look. http://collectorwiz.com/slots/reeltest.php <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style> #holder { float: left; height:
Multi slideout divs
Hi, By searching the web I've found a way to have multi divs slideout from the left but I can't figure out how to toggle them i.e. when one div is clicked the previous opened divs closes. This my jQuery so far, would appreciate someone's help thank you. jQuery(function($) { // jQuery 1.9 > Toggle Event dep 1.8 $('#slideClick').click(function() { var it = $(this).data('it') || 1; switch ( it ) { case 1 : $(this).parent().animate({left:'0px'},
Pass encryption key value securely to URL
Hi, I am updating my database programs and came across this code snippet that is NOT secure in that you can see the value of "myKey" as it is passed. $('button[name="revise"]').click(function() { location.href='accountRevise.html?recId='+recId+'&company='+company+'&myKey='+myKey }) I don't think $.post would work as I want to end up at, and stay at, the 'accountRevise.html' page. What would be the best way to pass this value securely to 'accountRevise.htlml' ? R.
jQuery-AJAX: Checking if Data Exists, if not “POST”
I am trying to check if the data already exists in the JSON Array Object that is returned on 'GET'. IF the data already exists, I want it to ignore the data. If it does not exist I want it to "POST." Please help. It seems to be skipping the "POST" call. function POST(section){ $.ajax({ type: 'POST', dataType: 'json', async : false, data: JSON.stringify(section), url: '/api/v2/help_center/en-us/categories/200384077/sections.json', contentType: "application/json; charset=utf-8", headers: { "Authorization":
Match element content and asign point per match.
I'm trying to compare orange and red boxes respectively to the green box, find LI's with matching contents and then assign points to them. With WHat I have so far, It doesn't asign the points correctly. E.g 1. The orange box shoud have 40 points because 4 ofs it Li contents all have matches in the Green box. 1. The orange box shoud have 430 points because 3 of its Li contents all have matches in the Green box. How can I achieve this. My code is as shown below. $(document).each(function () { var
JQuery Dialog not Showing in Front
I have the below jquery codes that stay behind when called. It pops-up but behind the current page. I call it using this <p id="onclick">Contact</p> $(document).ready(function() { $("#onclick").click(function() { $("#contactdiv").css("display", "block"); }); $("#contact #cancel").click(function() { $(this).parent().parent().hide(); }); // Contact form popup send-button click event. $("#send").click(function() { var name = $("#name").val(); var email = $("#email").val(); var contact = $("#contactno").val();
jQuery 1.x and 2.x detecting browser with PHP
<!doctype html> <html> <head> <meta charset="utf-8"> <?php // JQuery 1.x and 2.x URLs $jQuery1 = 'jquery-1.11.2.min.js'; $jQuery2 = 'jquery-2.1.1.min.js'; // Default $jQuery = $jQuery2; // User Agent $arr = explode(' ',mb_strtolower(str_replace(array('.','/'),' ',$_SERVER['HTTP_USER_AGENT']), 'UTF-8')); for($i=0; $i < count($arr); $i++){ if($arr[$i] == "msie"){ // Internet Explorer ? if($arr[$i+1] <= 8){ // <= 8 version ? $jQuery = $jQuery1; // Jquery 1.x } } } // Print echo '<script src="'.$jQuery.'"><script>';
Why is this jQuery integer math failing?
I've got this jQuery to sum all values in "Amount" columns on exiting any of them, updating the "Total" text input with the total: /* boxAmount1...boxAmount5 - when any of them change, update boxGrandTotal */ $(document).on("blur", '[id^="boxAmount"]', function (e) { var amount1 = $('[id$=boxAmount1]').val(); var amount2 = $('[id$=boxAmount2]').val(); var amount3 = $('[id$=boxAmount3]').val(); var amount4 = $('[id$=boxAmount4]').val(); var amount5 =
How to set autoheight of textinput?
Hi, I have set a width of text input to 100% of my div. But how to set height of this text input when first line is filled up? .. then it should give me a new line ... or in reverse ... if I am deleting some characters from for example second line, and there are no more characters and I press Backspace ... then second line disappear ... hope you understand me. And thank you for answers.
Div alignment on Click
A requirement for my project is that when a user clicks on the a link the page scrolls to the next section on the page. The issue is that every screen height is different. Aligning to the beginning of the next section doesn't solve the problem. So instead of scrolling to the top of the next section i want to scroll so that the bottom of the next section is aligned to the bottom of the viewport. Is that possible. Can anyone provide code to acheive this.
jquery form elements
Hi, I have a variable which contains html form name, and this variable gets updated dynamically. How do i loop all the form elements which has id parameter and get values of those elements using jquery? Thanks,
Does jQuery 2.x support IE11 Enterprise Mode?
We are currently starting development of a new enterprise intranet framework. In the conceptual phase the question arose, whether we can incorporate the latest version of jQuery 2.x, bearing in mind that IE11 might run in Enterprise Mode. Enterprise Mode means IE8-compatibility, so does this impose jQuery 2.x will not support it? Many thanks in advance!
AJAX double call on submit
I'm using bootstrap 3.0 form and want to do ajax submit instead of regular one. I like bootstrap's form validation and I use preventDefault() to stop original form from firing. but form still keeps firing on submit so I get 2 submits instead of one. I now removed "action" url from the HTML form so it now fires on .html?parms how do I prevent original form from firing? I tried on "click" but bootstrap's validation stops working if I do that. $('#investorsSubmit').on('submit', function (e) {
Is there are shorter way than using each() to apply something to each item within an array?
Hi Guys, So I've done some development using the groovy language recently and wondered if javascript or jquery has something similar (I'll just use pseudo code to illustrate my point faster). Say I have a function that accepts an array of strings, but the array I have contains integers: myFunction([1, 2, 3, 4]) Lets say there was a function called toString in the library that converted objects to strings. If I tried just doing [1, 2, 3, 4].toString() it would just convert the array object into a
Resizing and re-measuring loop
Is there any delay between I change a CSS property from a container and the elements inside/around can give me a correct reading of their dimensions? If there is, how do I force a repaint / recalculation and listen for the completion to re-measure them?
Having Issue on Adding animation to Dynamic element in jQuery
Can you please take a look at this demo and let me know why I am not able to add the .slideDown()function to the process of entering a dynamic div after the parent of selected element? $(function () { $("button").on("click", function () { $(".err").hide(); var elem = $(this); elem.parent().after('<div class="alert alert-danger err" role="alert">Thanks For Adding</div>').slideDown("slow"); }); }); @import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"); body { padding:50px;
How can I getthe current country name?
Hi all, How can I get name of current country/state ? I want to show a certain content of my page according contry where is user who open my web-page. Thanks for answers.
Help making menu script better
I have made this menu here: http://jsfiddle.net/demiurgen/p331xkde/ But surely there must be a better way of doing this? Can anyone help. I am a total newbie with js and jquery.
Using PHP to submit a form updated by jQuery
In a recent previous post (here ) I wanted to know how to update an "input" field using jQuery by first finding it in the row that was dragged and dropped into place - so that the sequence was recorded properly. I thought I could than hit Submit and $_post the information to the database as normal. However, I found that I could not. In fact the "LAST" item I moved never recorded the information and I had two records with the exact same sequence. I tried it moving it to the first position, to a
Using Bootstrap panel collapse only for mobile, howto
Hey! For a Wordpress-Site I want to use the collapse-function of bootstrap. If you watch the website with a smartphone or tablet, you don't see the whole content. Like Wikipedia. On a desktop it is default to see the content. I can't duplicate the content and just use the bootstrap classes visible-xs and hidden-xs, because it is a side for a client, and I can't double content. How can I say that the default on mobile is .collapse and the default on desktop is .collapse.in ? Thanks a lot!
How can i convert the date and time form my Database to the customer timezone with respect to their IP address
I am using PHP codeigniter with msql
How can I hide an HtmlTableRow?
I've got an HtmlTable that is created with six rows (HtmlTableRows). By setting "display" to "none" on the last four rows, it only displays the first two rows by default, but the HtmlTable can "grow" up to six HtmlTableRows (from the user's perspective) with this code: /* This makes the next hidden row visible, as long as there is one */ $(document).on("click", '[id$=btnAddFoapalRow]', function (e) { $('[id$=foapalhtmltable]').find('tr:hidden:first').show(); }); The above works; I now need to
Can't Run jQuery in Chrome console
I have 2 sites http://www.perfect-rehitim.co.il http://triplebit.com/plugin1 I try to run the following script on both under Chrome: $.each( $('*'), function() { if ( $( this ).width() > $( 'body' ).width()) { console.log( "Wide Element: " , $( this ), "Width: " , $( this ).width()); } }); On the first it runs fine. On the second I get the following result: Uncaught TypeError: Cannot read property 'each' of undefined at <anonymous>:2:2 at Object.InjectedScript._evaluateOn
Anchor link to different page not working (jumping back to top on load)
Hello there! Been a while since I last came here, and as always I bring you a fine conundrum today: Pretty simple: Buttons on index.html links to specific parts of a different page through anchor id's. Problem is that while it is loading the new page, it always goes to the top of it rather than the point where I want it to go. For some reason every time I do a fresh reload of the page, it does go to the anchor on load but only for a second before jumping back to the top of the page. Like something
Table row count incorrectly reported after appending a row
I have an existing table in html. See below: <table id="test_table"> <tr> <td>Col1 Row1</td><td>Col2 Row1</td> </tr> <tr> <td>Col1 Row2</td><td>Col2 Row2</td> </tr> </table> I then use jquery to append another row using the following function: function append_last_row_to_table(table_name, cell_contents) { var last_row_idx = get_number_of_table_rows(table_name); $("#" + table_name + " tr:nth-child(" + last_row_idx + ")").after(cell_contents); } I then use jquery
jquery syntacx error
Hi i am new to jquery, and i have the following script i am trying to modify with an "or" statement. i am now getting an error "Expected ')' to match '(' from line 1 and instead saw '}'. when i change it i get the error. What am i doing wrong? $ ( document ). ready ( function () { if($('.toggle-nav') || $('#navigation li a').click(function(){ $('#navigation').toggle(); } }); });
jQuery events with dynamically loaded widgets not working
Short question: When I dynamically load a div on the page in jQuery, it seems to not respond to jQuery events. Is there some way to register the events needed? More detailed description: I have a class called closebox that when clicked, closes the box and serializes the widgets. This is working well for divs that were loaded when jQuery was initialize: $('.closebox').click(function (event) { event.preventDefault(); var hpanel = $(this).closest('div.hpanel'); hpanel.remove();
Solari Board
Has anyone tried this addon? https://github.com/FogCreek/solari-board I've downloaded it and tried the example with no joy - no sound either. I tried IE and Chrome with no luck
jQuery Functionality Question/request for guidance.
Hi all, I'm hoping that someone will be able to point me in the right direction for a solution. I'm essentially trying to put together a 'simple' search/filter system for a website project I've decided to do and would like to add a little something more than just a form of combo boxes (which I can do no problem) so after seeing what jquery can do, I was wondering if anyone knew of a plugin/script that would allow me to what is illustrated in the following image. I've had a quick look through the
How to shrink all <img> pictures on a webpage to 60% or original width/height?
Assume I have the following webpage: https://www.raymond.cc/blog/5-system-rescue-boot-disc-based-on-windows-pe/ After loading the web page in Firefox I want to execute a jQuery script which shrinks all images (of the core article) to 60% of the original size. jQuery script execution should be triggered out of a Greasemonkey script. So how would a jQuery statement look like which selects all <img> elements, find out their original size, calculates the new size (without fraction) and applies the new
POST COMPLETE
I have a form i'm posting (see this thread: https://forum.jquery.com/topic/ajax-post#14737000006338031) I want to call another function when this post is complete. how can I do this?
Loop through elements in has selector
I have the below code. Right now it only gives me the first element that satisfies the has condition. How can I loop through all the items returned/satisfied from has selector and perform the color change function. var data = $('.tab-pane').has('.input-validation-error').attr('id'); var href1 = "#" +data; $("a[href=" + href1 + "]").css("color", "red"); Thanks
.hover() function works but image flickers multiple times
<!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script> $(document).ready(function() { //preload images var nNormal = $("img").attr("src"); var nHover = new Image(); nHover.src = "http://d0od.wpengine.netdna-cdn.com/wp-content/uploads/2015/02/wallpaper-icon.png"; //attach hover event $("img").hover( function() { $(this).attr("src", nHover); }, function() { $(this).attr("src", nNormal); } ); }); </script> </head> <body> <div>
How to find and updated an INPUT field?
I created a JSFiddle to help explain the change I wish to make. <tr> <td class='priority'> <input name="sequence" value="1" size="6" /> </td> <!--Added INPUT field in the td class priority--> <td>George Washington</td> <td>Apple</td> <td>N</td> <td><a class='btn btn-delete btn-danger'>Delete</a> </td> This would be generated from a php call to a database that is currently working well.
understanding usage of deffered.promise in jquery animation
hey guys have a look at this code below , FIDDLE HERE Code here :: $("button").on("click", function () { $("p").append("Started..."); $("div").each(function (i) { $(this).fadeIn().fadeOut(1000 * (i + 1)); }); $("div").promise().done(function () { $("p").append(" Finished! "); }); }); now what is promise() even doing in this code ? . aso another question i woudl like to ask is , is Deferred, Promise and Future a Javascript thing ? or is it all only exclusively
Why does changing the val of a text input element in jQuery not fire my TextChanged event?
I'm trying to change a value in jQuery that will cause a chain reaction, so to speak, to fire the element's TextChanged event. I've got this server-side code: PDFGenBtnClicked = new TextBox(); PDFGenBtnClicked.ID = "pdfgenbtnclicked"; PDFGenBtnClicked.Text = "no"; PDFGenBtnClicked.Style["display"] = "none"; PDFGenBtnClicked.AutoPostBack = true; PDFGenBtnClicked.TextChanged += new EventHandler(PDFGenBtnClicked_TextChanged); . . . protected void PDFGenBtnClicked_TextChanged(object sender, EventArgs
AJAX POST
I want to post my entire form, do I need to specify each field or should this work? $( document ).on("click", "#register-submit" , function() { $.post( "register-process.php", {}).done(function() { alert( "Registration Complete"); }); })
How to Use a Variable As Array Name
How can I make the alert work? ========= code ============= var arr0 = ["king", "queen"] var arr1 = ["boy", "girl"] var arr_name = [" arr0", "arr1"]; alert( arr_name[0 ]. length);
ie11 Unable to get property 'nodeType' of undefined or null reference
I have a curious problem that I have been struggling with for a few days. I have a simple psp page written with jsp 2.2, richFaces 4.5.7 (which loads jQuery library v1.11.3) running on a WildFly-9.0.0 server. When I load the page in Internet Explorer 11 (it all works in Firefox and Chrome) I start to get errors, the first is in jquery.js line 4198: // Minified: var a,b,c var input = document.createElement( "input" ), div = document.createElement( "div" ), fragment = document.createDocumentFragment();
splice and push - Easy But..
alert(process_stage1[1]) returns undefined. Why??? stage0 =["a", "b", "c", "d"]; -----------------[code] ------------------------------------------- var stage_status = 'initial_stage'; if(stage_status=='initial_stage'){ var init = stage0.splice(0, 3); process_stage1.push(init); alert(process_stage1[1]); // undefined??? Why??? } //if
Next Page