Writing my jquery code more efficient
Hi there, I am relatively new to jQuery and javascript coding in general and I am trying to write cleaner and more efficient code. I am actually a designer and not a coder but I try my best. :D I have some objects on a website that I am animating with AnimateCSS and jquery ( https://github.com/customd/jquery-visible ) and I am wondering if I can write the code more compact to save some kb. Here is an example: var boxes = jQuery('div.box'); var event_list_item = jQuery('#event-list div.card-container');
jQuery 'Manual' Form Validation and Random Array Output
My project consists of 3 parts. 1. Enter 3 pieces of information via a form 2. Manually validate the 3 pieces of information have been entered 3. Output random value from pre-populated array For the manual validation I would simply like to verify that all fields have a value. If they are blank the user will be prompted with a specific error message based on the field. (Enter a first name, enter a middle initial, enter a last name) Once all 3 values are populated and the user clicks Submit they will
Position option in jQuery UI menu: y axis can only be centered (top/bottom don't work). (Bug?)
I'm using jQuery-ui 1.11.4. I've set up a menu to run horizontally across the top of the screen (by floating top-level li's to the left). The submenu default position is "my top left at top right". I want it to be "my top right at bottom right", so it won't interfere with movement in the top-level menu. When I specify this (or any other value), the y-axis is always "center". I've tried using various pixel adjustments as well, with no change. Sounds suspiciously like a value is being set to
Using selector
I am trying to get all of the form elements. I am successful with this: $("input, select").each(function(){ I am worried that if I add another form though, that this will pull those fields from that form as well. I tried adding "#form" and "form" to the front (of each), as well as putting ":" in front of input/select, but it only pulls the input fields then.
update the font family for special characters using jQuery
Hi all, please bear in mind i am a beginner I am using a font family that does not render special characters characters such as &,£ etc. so im looking for a solution to target all special characters (site wide) and change them to a different (similar) font family. Can this be achieved using jQuery? For example declare an string array that holds the characters i want to target and write some code to update these? Using the following jQuery it will target the word package in any h3’s site wide, apply
Avoid scrolling back to the top of the page prior to transition.
Hi, with JQuery Mobile is there anyway when you have page content that requires you to scroll as it is longer than the available content length that it doesn't automatically scroll back to the top when pressing a back button on a fixed header? Then before you transition to that page again you can scroll it back to the correct position? Thanks, A4.
News outlet JQuery code works in Chrome but not Firefox
The following JQuery code is from a "news" outlet, The Daily Caller. A click on a graphic invokes a Disqus comments section to any Daily Caller article. It works in Chrome, and it used to work in Firefox, but now It does not work in Firefox ESR 38.8.0. I don't know what I might have changed in Firefox. It is not my code. It appears to be something in Firefox's runtime / add-ons. Do you have any idea what may be going wrong? <a class="show-comments" onclick="loadDisqus(jQuery(this), '5039587 http://dailycaller.com/?p=…publican-establishment-join-the-new-party-or-say-goodbye/');">
Accessing dynamically generated dialog using JQuery
Hello Everyone thanks in advance. I am initiazializing a dialog on the fly using the following code: $("<div id='timeOffDiv'><div id='timeOffDivInner'>loading....</div></div>").dialog({...options go here....}); I use this often in my app and it works well..usually on open, I populate the content of the dialog dynamically using ajax. later, based on user controls, I need to change the dialog buttons, and I use the following code: $('div#timeOffDiv').dialog('option','buttons', [ { text:
CORS request is not sending cookies
Hello, I have posted this question to different forums but didn't get a single answer. So, will try here. I use blueimp/jQuery-File-Upload script for cross domain (subdomain) uploads. The main page is www.example.com and I upload files to st2.example.com. Everything works fine but the problem is that I need to send cookies with each request and for some reason it's not possible. Cookies are being sent only with HEAD requests. The documentation of this script says: If you need to send along cookies
Why logging the textcontent makes it go to the scrollbar when scrollbar is not pinpointed to in the codes?
Hi Folks, How are you? I wish you are fine. May I seek your inputs as I am stuck with something below? Refer to the following html codes, and what I don't understand is why clicking on the last button, ie 4th button, which would print the text on the button to the log would actually get transferred to the scrollbox. Because clicking the 4th button merely logs the textcontent, but does it specifically identify the scroll box as the area to dump in the text? Yet it works, astonishingly. click(function
JQM - Navbar Link Remains Active.
Hi, I am using JQM 1.4.5 & jQuery 1.11 and have the following code; <li><a href="#" id="btnReset" class="ui-disabled" data-icon="custom">Reset</a></li> This calls a function; $('#btnReset').bind('click', function(){ $('#btnReset').addClass('ui-disabled'); } That works fine but the button remains in an active state (i.e. black but disabled). How can I alter this to return it to normal state? Thanks.
Spinner Doesn't Work While AJAX Does Its Job
I'm trying to get a spinner to show up while my form does submitting data. So far, my AJAX works absolutely fine and does its job; but the spinner just won't show up! Here's my JavaScript (properly queued inside WordPress) - -- jQuery(document).ready(function($){ //'use strict'; $("form").submit(function() { event.preventDefault(); $(".myspinner").css('display', 'inline-block'); var wpajaxurl = document.location.protocol + '//' + document.location.host + '/wp-admin/admin-ajax.php'; var form = $(this);
why submit on second page load not working
Hi, here: https://www.mybluefile.com/forgot_password.php when I first load the page it works and submit goes via jquery but when I go back to the main page index.php and then click on forgot password the submit doesn't work via ajax and it just do: https://www.mybluefile.com/forgot_password.php?txtUserID=731004167&btnForgotPassword=Reset+your+Password why is that? Thanks, Jassim
how to “undo” jQuery toggle callback?
Here's the demo... http://brinsterinc.com/ovnproj/app/gestation.html Click the purple stack and the menu area shows, and there's a callback to fade in the menu items. When the menu hides via the toggle, I'd like the steps to reverse. That is, the menu items to fade away before the menu area hides. Do I have to code it without the toggle? BTW, trying to avoid needing jQuery UI. Here's the code... $('div.bars').click(function(){ $(this).next().toggle("slow", function(){ $("div.ovnMenu ul").fadeTo("slow",
How to clear a function?
I'm using a basic slideshow plugin but my problem is need to have a multiple slideshow. This is the sample code: $('a.lightbox').bind('click', function(){ var aIDL = $(this).attr('href'); $(aIDL + ' ' +'.detail_list').bjqs({ animtype : 'slide', width : 458, automatic : false }); }); every time i click a a tag it will execute the function. the problem is if the user need to click multiple times. so i want to clear the function after the user click a close tag.
Learn suggestion: Select by ID with escaped characters
Hi! The page How do I select an element by an ID that has characters used in CSS notation? could also mention a simple solution that is also faster: // Does not work: $( "#some:id" ) // solution with no string replacement: $( document.getElementById("some:id"))
A Slideshow Plugin that can be use multiple times?
Guys, do you have any slideshow plugin that can be use multiple times into a page? can you give me a link? Thanks!
Loop through class with if statement
Hi all, I have multiple divs with class .repository_image all containing an image. I need to loop through them and assign the class .portrait if it contains an image that is in portrait orientation. I tried the following but it did not work :( $('.repository_image').each(function(){ if($(this).width() < $(this).height()){ $(this).addClass("portrait"); } }); What am I doing wrong?
select specific options in forEach
Hi, guys! Could you please help me to resolve one task. I get some JSON response from backend side, it's array, now I trying to use cycle forEach for displaing each iterable on html page. It looks like: jQuery.each(data, function (key, value) { $(' + '<div>' + "'+ value.title + '" + '</div>' + '<div>' + "'+ value.price + '" + '</div>' + '<select class="hours f-left">' + '<option value="1">1 hour</option>' + '<option value="2">2 hour</option>'
faster use of jquery-ui via class iteration
I found it a bit of a hassle to "register" every div that I want to use with a jquery-ui widget. So I wrote a little bit of code. Basically, every widget type gets a class name. For example: if you have multiple buttons you dont have to write " $('#id1".button(); $('#id2".button(); $('#id3".button(); etc anymore. You just add the class "btn" to any div in your html code and my code does the rest. <div class="btn"> <button onlick="">Button</button> <button onlick="">Button</button></div> Widgets
"use strict" causes the error $this is undefined
Hi, The code bellow works without "use strict" but when I add "use strict" to it, it shows an error saying "Uncaught TypeError". (function ($) { "use strict"; $('.field-widget-file-generic').each(function () { $this = $(this); if(!$this.find('.table-striped').length && $this.find('.file-widget span.file').length) { $this.find('.file-widget span.file').closest('.file-widget').addClass('only-one-file'); } }); })(jQuery); I need to use "use strict" but
How to make an image (jpeg or png) expandable on image touch in a jquery mobile?
How to make an image (jpeg or png) expandable on image touch in a jquery mobile?
How to embed youtube and social networks links in a jquery mobile pages?
How to embed youtube and social networks links in jquery mobile pages?
How to add search functionality through all jquery mobile pages?
How to add search functionality through all jquery mobile pages in a kind of a ebook?
How to make text size expandable on screen touch in jquery mobile?
How to make text size expandable on screen touch in jquery mobile?
How to show text percentage read on a jquery mobile page?
How to show text percentage read on a jquery mobile page? Need to visualize place on a big page where an eye reads.
checkbox to disable and enable textbox
hello everyone, i have 2 checkbox(Yes/No) that act like a radio button. If the Yes checkbox is checked i want to enable a textbox and if the No checkbox is checked it will disable a textbox, using jquery
Creating a chat feature with JQuery?
I need to make a chat feature in my website and would like to know how to do it using only HTML, CSS, JS/JQ, SQL and PHP. How would it work? Would the server contact the user when a new message has been posted, or would the user have to constantly make requests to the server to check if it has been updated? What's the best way to do this kind of thing, and keeping in mind to not overload the server in case there are many separate chat rooms, each with many users. At the moment I am thinking to use
.slideDown Help
<style type="text/css"> body { margin: 0; } ul { list-style-type: none; margin: 0; padding: 0; width: 25%; background-color: #f1f1f1; position: fixed; height: 100%; overflow: auto; } li { display: block; color: #000; padding: 0px 0 0px 0px; text-decoration: none; } .submenu1 { display: none; } .submenu2 { display: none; } .submenu3 { display: none; } .submenu4 { display: none; } </style> <script> </script> </head> <body> <ul id="Menu"> <li><img
datepicker dynamic
Dear members, I am unable to add jquery datepicker to a dynamically created textbox. the datepicker is working fine on the first row, which is present on the first load of the page. here is the code. script to dynamic adding rows with fields. <%-- Document Add --%> <script type="text/javascript"> // $(document).ready(function () $(document).ready(function () { $(document).on("click", ".classAddDoc", function () { var templateRow
Submit a form by clicking on an option
Hello, I'm working on a Django app and I'm not very used with jQuery. I want to retrieve some questions and answers for a quiz and I use a form to answer. It's multiple choice. I have added on the list an event (like <li onclick="game.submit()") which is nearly what I want to achieve. I use radio select buttons so when I select an option it automatically sends the form and retrieves the next question. What I want is to eliminate that radio button select and let the user choose his answer just by
dynamic drop event is not triggered on droppable
I have this piece of code. The problem is that the drop event never called.. What could be the reason? I want to be able to drop the element just after the target element is initialized as droppable. $('.draggable').draggable({ iframeFix: true, helper: 'clone', revert: 'invalid', drag: function (event, ui) { externalIframeContents.find('.getting-hovered-by-helper').css('box-shadow', ''); externalIframeContents.find('.ui-droppable').droppable("destroy"); var m_ui = ui; clearTimeout(timer); timer
Global variable very basic
Hello everyone, I have a very basic question with global variable and Jquery. Here i is a counter. I want to know its last value and keep it out of the function <div class="aremplir"> </div> <button type="button" id="ajouter">Ajouter</button> <script type="text/javascript"> jQuery(function($){ var i = 0; $('#ajouter').click(function(e){ e.preventDefault(); var content = "<div id='input_name"+i+"'><input type='text' /></div>"; i++; $('.aremplir').append(content);
Get a value from database after onChange event of Dropdown with JQuery
Hello , Iam trying to find a solution for dropdown selected item, {{ Form::select('idShow',array('0' => 'Select one option') + $shows, $event->idShow, array('class' => 'form-control', 'id' => 'idShow')) }}. After i slect an item I want to gat from databse two other filed that have the id of selected item with onChange event in Jquery.Can you tell me please if have manner to do it ?
download an old version of a theme
Hi, i need change a theme that i use in my web. I used a theme named cupertino in version 1.8.18. Now i need change it to use other edited but i can´t download the version 1.8.18 of my new theme, i only can download in version 1.9 or higgest... can somebody help me? i don´t want change every code, i want use the same but with a new theme wich i've edited. Thank you. Sorry for my english :)
Drag from sortable to sortable
Some helpful member in this forum provided me with the following: * Having sortable rows inside table, with different sections (made with tbody) * Save the reordered rows in local storage. I'm very happpy with the solution. Now I have created a second table, with the same structure. So I want to drag rows from "Table Sortable 1" to "Table Sortable 2". I have made some efforts doing this, but the problems that occurs is the following: 1. When rows are dragged between the sections of Table Sortable
Can´t submit form content of a jQuery UI modal windows
I like to use the jQuery UI modal dialog, to create new users in a database by using php code. I get the modal code example from the jQuery UI page and the form is opend in the modal window. The orignal code example just adds the form datas into a table on the page with /$( "#users tbody" ).append... and so on. But I need to submit the form datas to a php file. So far so good. I thought, okay I´ve just to replace the append code part with $("form#modal-form").submit();and it´s should be working.
Bit confused by how JavaScript/JQuery executes code?
I'm a C++ programmer, and I'm watching some tutorials on JS/JQ and I'm having trouble understanding something (something no one seems to explain). Where is the executor in JS/JQ? In C++, code is executed in an ordered fashion, staring at main, and flowing from top to bottom, and finishing at the end of the main function. With JS/JQ it seems almost mysterious. If I have a .ready() function, does it execute it once, or does it keep looping? If it only executes it once, then how is it possible that
How to BLOCK several asynchronous gets
Hello, I've tried a couple different ways, and the best case that I had was a series of nested $.get(...).then(...) callbacks. This works, to a point, but leaves me with a JavaScript stack overflow on the client side, best guess; the ASP.NET server side is "happy", at any rate, but this is useless unless the client side can digest the results without stack overflow. I need to know how to BLOCK each $.when(), or $.get(), might be better, or if I can simply block and wait for the done handler to be
Could Jquery affect my captcha?
Has there been a new update to jQuery v1.6.4. I have a contact form that my captcha has stopped working. I check the server and they say it was in my html. Anyone knows about this. Thanks!
Next Page