FAQ Database Discussion Community


JQuery UI slider - value slider 2 determined value slider 1

javascript,jquery,html,jquery-ui,jquery-ui-slider
Ive been trying to get with JQuery UI slider the following to work. Ive got 2 sliders, one is a amount the other is a duration. When the amount is lower then 200 you can select 15 and 30 days. If the amount is higher than 200 only 30 days...

inverted commas does not work for multiple line in jquery

jquery
I am trying to put huge html code in jquery , using inverted commas,but after a line break , inverted commas is not working , How to do this ,Can anybody suggest how to do this .The html code is written append $(document).ready(function(){ $('#addmore').click(function(){ $('#item').append("<div class='form-group'><label class='col-sm-4 '>Period</label><div class='col-sm-8'><div class='checkbox'><label><input...

add value to existing class in jQuery

javascript,jquery,html,css
EDIT - included the page where the problem is visualized - http://www.openmindedmedia.nl/testfase/julius/ First of all, I have searched quite some hours to find this.. I presume it has an easy fix but I'm really new to jQuery and Javascript, so I'm here for your help. The problem I'm working with...

Need to apply an alpha gradient to both sides of an image

jquery,css
I'm trying to blend out an image using jQuery or CSS (or both, of course.) Given the below HTML, is there any way to do this? I've found a few options but they seem to require a fixed width, which I won't have as these images are dynamically driven. <div...

Target next instance of an element/div

javascript,jquery,html
I have the following HTML structure and JavaScript file: .html <li> <button class="show-more"></button> some more elements <div class="hidden"></div> </li> JavaScript $( ".show-more" ).click(function() { event.preventDefault(); $( this ).next().slideToggle( "fast", function() { }); }); I need the click event to toggle the next first instance of .hidden, however the click event...

JQuery .width() for this element

jquery
How can I get width of element which I css. My code: $('a').css({'left':-$(this).width()/2}) ...

How to remove all the borders of a selectbox?

jquery,html,css,drop-down-menu
How can I remove the all the borders of the selectbox using css or Jquery ? My code, <select id="doctor_ch"> <option value="1" selected>One</option> <option value="2">Two</option> </select> CSS #doctor_ch{ background-color: #88AFF2; color:#fff; margin-top: 15px; } When I use this code it only changes the arrow style. I want to remove the...

unable to apply toggleclass for bg after js script execution

javascript,jquery,html,css
i have this button on a page ... <div id="bgtoggle"> </div> i also have this script on the index page <script> $(document).ready(function(){ $("#bgtoggle").click(function () { $(".metro").toggleClass("bgcolorchange"); }); });</script> the class bgcolorchange has this css .bgcolorchange { background-image: url("../images/mthc/music-therapy-imageN.jpg"); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; overflow : hidden ;...

Datatable event on page change not working

jquery,datatables
This is what I want when the page is changed: $('#resultTable').on('page.dt', function() { if (document.getElementByID('r_tab').checked()) { $('.r_tab').show(); console.log('page changed on r'); } else { console.log('page changed on p'); $('.p_tab').show(); } }); When I run this code, I am not able to change the page anymore. Clicking on any page number/next...

How can I iterate through nested HTML lists without returning the “youngest” children?

javascript,jquery,html,list,loops
Fiddle: https://jsfiddle.net/zayjeLrk/12/ I want to iterate through an HTML nested list that is 3-layers deep. <ul> <li>animals <ul> <li>birds <ul> <li>crow</li> <li>parrot</li> </ul> </li> <li>reptiles</li> </ul> </li> <li>plants</li> <li>bugs</li> </ul> I want it to iterate through the list so that it returns the elements in this order (note, this isn't...

Why is JQuery index() returning 1 for the first element?

jquery
In the following line of code, a call to the index() function for the first element in a set returns 1. Why does it not return 0? var firstBlockIndex = $( '.block' ).first().index(); ...

jQuery click open one dropdown

javascript,jquery,html
In a site I have several 'dropdown' which become visible when you press a plus sign. I did this with jQuery (see code below), but when pressing the button every dorpdown opens. How can I only open the dropdown where the button is pressed (Without writing this code for every...

Onclick add html content and remove it by clicking “delete” link

javascript,jquery
I have some issue, help me please to find where is the mistake. $(document).ready(function(){ $(function() { var scntDiv = $('#p_scents'); var i = $('#p_scents .row-wrap').size() + 1; $('body').on('click', '.add-item', function() { $('<div class="row-wrap cf"><div class="col-md-3 col-sm-3 col-xs-12"><input type="text" placeholder="Наименование" name="item_name' + i +'"></div><div class="col-md-2 col-sm-2 col-xs-12"><input type="text" placeholder="Количество" name="item_count' +...

Show/hide with jQuery

javascript,jquery
I'd like to show or hide unordered lists, based on when someone clicks a heading. I've found a way to do this, which would work fine for a single list. As I have multiple lists, it's not very efficient. Please forgive the ugly table code - that doesn't exist in...

How to alter dynamic/live element attributes - (replaceWith()) used

jquery,dynamic,replace,live
I am having a hard time wrapping my head around how to access and alter attributes of HTML content added in place of a placeholder element using replaceWith. Here is the scenario: Here is the HTML (kept in a php file) that replaces the '#null_item' element in the subsequent HTML...

Select DIV ID based on its class

javascript,jquery
I need to select and use a DIV's ID but I don't know the name of it so I want to search for its class which I know. How would I do that? I can use either plain JS or jQuery, doesn't matter. I want to be able to get...

access the json encoded object returned by php in jquery

php,jquery,ajax,json
I want to post some data to php function by ajax, then get the encoded json object that the php function will return, then I want to get the information (keys and values) from this object, but I don't know how, here is my code: $.ajax({ url: "functions.php", dataType: "JSON",...

Setting radio button checked true on button click

javascript,jquery,html
I have a table cell that lights up when selected. There will be many buttons on the page but only one choice can be made at a time. How can I make them mutually exclusive using hidden input radio tags? (in order to handle the group later) <td class="choice-option"> <input...

Modal won't close on ajax success

jquery,ajax
I'm loading in the content of a modal with ajax. I have a button that submits the modal form and is suppose to close the modal when it's done processing the ajax submit so it can update a table at the bottom of the page. It's not closing the modal...

show/hide an overflow div on anchor

javascript,jquery,html,scroll
I'm trying to make a div appear (if not already visible) and be scrolled to a specific anchor. I found this answer and try to use it but it looks like it doesn't work well... http://stackoverflow.com/a/7513110/3703099 My code : http://jsfiddle.net/0sq2rfcx/9/ As you can see, when you click on button it...

jQuery validate equalTo

javascript,jquery,validation
I would like to use jQuery validate() plugin using the equalTo to validate a signature field, basically the signature field must match the first name and last name field, is this possible using the validate() plugin? http://jqueryvalidation.org/equalTo-method/ shows me how to check if it is equal to another input, but...

Rerendering Handlebars template upon data change

jquery,handlebars.js
I have a template that shows a button based on some boolean in a JSON-object. There are two different buttons it can show. The code for compiling the template: source = $('#some-template').html(); // Get the HTML source of the template template = Handlebars.compile(source); // Compile it $('#some-div-container').html(template(someJsonObject)); Let's say the...

Trying to implement an object-oriented design model for a simple navbar using TypeScript

javascript,jquery,typescript
Greetings fellow Earthicans, The following code is used on my website: brianjenkins94.me in order to handle baseline navigation functionality and while it was working previously I decided to leverage the class-based approach provided by the TypeScript Language in order to structure my code in a more readable fashion. In doing...

How to make function in loop run synchronously?

javascript,jquery,loops,google-chrome-extension,synchronization
Am working on a chrome plugin, and need to sendMessage from an 'app page' to a 'content script' and then get the return messages, from inside a loop. But since the loop doesn't wait for the sendMessage to return a value before starting on the next iteration, it is screwing...

How to add new elements to the page via function calls, and attach event handlers to them, without specifying them inside the function?

jquery,jquery-ui,jquery-mobile
So I have an app. It's written on jQuery(UI & Mobile). I have this page structure: Main Page: <!-- Main Page --> <div data-role="page" id="home"> <header data-role="header" data-theme="a"> <h1>Running Tracker</h1> </header> <div data-role="navbar"> <ul> <li> <a href="#add" data-transition="fade" data-icon="plus">Add Run</a> </li> </ul> </div> <div data-role="content"> <h3>Welcome to the RunningTracker App</h3>...

Backbone render template in side el's nested id

javascript,jquery,backbone.js
I have my html setup like this. <div id="product-module"> <ul id="product"> <li><input name="product" type="radio"/></li> <li><input name="product" type="radio"/></li> <li><input name="product" type="radio"/></li> </ul> <table id="quantities"/> <script id="myTemplate" type="text/x-handlebars-template"> {{#each this}} <tr> <td class="quantity"> <label class="checked" for="quantity_{{id}}"> <input type="radio" value=""...

Converting “i+=n” for-loop to $.each

javascript,jquery
I have the below html structure: <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> Now to group/wrap each 4 items in a separate div I did as below: var div=$('.thumbnail'); for(var i = 0; i < div.length; i+=4) { div.slice(i, i+4).wrapAll("<div...

Dynamically increasing radio button validation

javascript,jquery
I have some radio buttons that dynamically increase based on data. What I want is to check if all radio button are selected or not. If they're not, I want to show an error message on that particular row as I am using form substitution to send data to ajax....

How to get the value of an html attribute

javascript,jquery,html
I have the following jquery code : $j = jQuery.noConflict(); function displaySelected(elem){ var value = $j(elem).find(".columnToHide").html(); console.log(value); } The out put of this is : <div class="hiddenId" data="a05o000000V88VFAAZ"></div>. However, I would like to only get the value in the data tag i.e. the id. I know you can do something...

Event stops working after dynamic ul li changes

javascript,jquery
The Code: if($('.info-dropdown').length){ setTimeout(function(){ $('li').has('input[type="checkbox"]').on('click', function(){ $(this).find('.brand-checkbox').parent().toggleClass('active'); }); }, 10); } The Problem: This code detects event click on element checkbox. After dynamically changing this ul li the event stops working. Note: These checkboxes are from bootstrap dropdown menu....

Difficulty applying two different scripts

javascript,jquery,html,css
I have this script embedded on the index page of my site: $(document).ready(function(){ $(".bgtoggle").click(function () { $(".metro").toggleClass("bgcolorchange"); }); }); The CSS classes the script refers to look like this: .bgcolorchange { background-image: url("../images/mthc/imageN.jpg"); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; overflow : hidden ; margin:0; padding:0; z-index:3; } .metro...

Default scrollbar position

javascript,jquery,html,css,scroll
I'm building a chat application in which I need the scrollbar to be at the bottom of the chat window (last message) on page load. How do I accomplish this (Using jQuery or otherwise)? Here's the chat window div: <div id="ccwindow"> <div class="bubble me">Hey!</div> <div class="bubble you">Hello</div> <div class="bubble me">I...

Javscript Replace Text in tags without changing children element HTML and Content

javascript,jquery
I have a script where I'd like to replace the text anywhere in the body visible to the user like so: $("body").html($("body").html().replace(/replaced word/g,'HELLO')); This works but it works to well. Whenever "replaced word" is within a tag, like a href, or span, or div, or anything it throws off all...

my svg polygons fills are not changing color on hover

jquery,css,svg
I have some svg polygons. When you mouse over a polygon, I want to find part of the polygon's id, then change the fill color of all polygons that have that part of the polygon id in their id. But it isn't working. No polygon fill is changing. Anyone know...

bootstrap - dynamically changing jumbotron background image

javascript,jquery,html,css,bootstrap
I'm trying to change the background image of the jumbotron div with jQuery when a new tab is clicked, like this: $(".about").click(function(){ $('.active').toggleClass('active'); $('.about').toggleClass('active'); $('.jumbotron').fadeOut(500); //change background image $('.jumbotron').fadeIn(500); }); I tried using $('.jumbotron').css('background-image',url('/path/to/new/image')); but when I include that line, the jumbotron background image doesn't display at all even before...

jQuery - Value in Function

jquery,arrays,function
My array: array.name = "Thiago"; array.date = "01/01/1990"; I want a function like this: function myFunc( array, fieldToCompare, valueToCompare ) { if( array.fieldToCompare == "Thiago" ) alert(true); } myFunc( myArray, name, "Thiago" ); is it possible?...

Add days, weeks, months to date using jQuery

jquery,date
I have a form which lets the user select an invoice date and payment terms. The payment terms are; 1 week from invoice date, 4 weeks from invoice date, 1 month from invoice date, etc. When the user has selected an invoice date and the payment terms I then want...

Background-image style with JS not working in ie9

javascript,jquery,html,internet-explorer
I'm working on a site and im having some issues with my slider in IE9. What I've done is that I've made a div that gets the background image changed every few seconds depending on the img tags within. You can see it in function here: http://diakondk.quine.pil.dk/ It works wonders...

How do I retain search engine accessibility when loading external file into html

javascript,jquery,html,seo,cross-platform
I plan to: $('#main.sidecontent').load('/sidecontent.html'); and insert: <div class="sidecontent" id="main"></div> a div on several html pages since the content of this div is the same and I try to straighten my workflow, basically avoiding editing every single html page when this content div changes. My questions: Is this method recommended for...

How to use css style for element with class from variable

jquery
$button = $(this).attr("class"); $fild =$button.replace('button','input'); //will get 'header_form_input' How can I apply CSS style for element with class $fild (header_form_input)...

Fancybox thumbnail is not working

javascript,jquery,html,css,fancybox
I'm trying to imitate this jsfiddle: http://jsfiddle.net/kevin11189/uZCC6/1269/ however the thumbnails are not appearing. Here's my code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Gallery</title> <meta name="description" content="An interactive getting started guide for Brackets."> <link rel="stylesheet" href=""> <style> .hidden { display: none; } </style> <!-- Add jQuery library -->...

Making an alert() with PHP and ajax

javascript,php,jquery,ajax
I have an ajax function that submits some data to my PHP file. In my PHP file I have some checks that it does with that data, I then try to make an alert to come up to say something. I can't get any alerts to come up though. All...

How to make an element disappear by clicking off it

javascript,jquery,html,css
I want to make a search that displays results right underneath it in a div that displays above other elements on the page (like an auto-complete or the address bar on chrome). I want to the results to stay visible wherever the mouse is, but disappear if the user clicks...

Response 200 OK but Jquery shows error?

javascript,jquery,json
I am stuck in kind of a weird problem where I am trying to make a JSONP request to the Open Weather history API to get the weather information for the previous years on the a particular date. fetchHistoryUrl = 'http://78.46.48.103/data/3.0/days?day=0622&mode=list&lat=39.77476949&lon=-100.1953125'; $.ajax({ method: 'get', url: fetchHistoryUrl, success: function(response){ console.log(response); },...

How to workaround a “negative” height and width?

javascript,jquery,html
I'm drawing a div on the document, but it only works when width and height are positives: var div; function onMouseMove (e) { div.height(parseInt(e.pageY) - parseInt(div.css("top")) ); div.width( parseInt(e.pageX) - parseInt(div.css("left"))); console.log(div.width()); console.log(div.height()); }; $(document).on("mousedown", function(e){ div = $("<div></div>").prependTo("body"); div.css({ "top": e.pageY, "left": e.pageX }); $(this).on("mousemove", onMouseMove); }); $(document).on("mouseup", function(){...

Javascript not executing when using link_to

javascript,jquery,ruby-on-rails
I have couple javascript functions that attaching action to buttons in controller view some/index. I navigate to some/index using link_to method. But when i'm using link_to method, buttons has no attached javascript actions (in some/index view). When i try open some/index directly from my browser, buttons have all attached actions...

Show and hide column in a table using drop down

javascript,jquery,html,table,drop-down-menu
I have a table, which looks exactly like this one: https://www.datatables.net/examples/api/show_hide.html I now want to replace the headers (the th things) with a drop down. I want to hide and show columns thanks to those drop downs (they can click and show what they want). I was also wandering if...

JQuery mutiple post in the same time

javascript,php,jquery,json
I have three functions ,and every function post to special php page to get data.. and every function need some time because every php script need some time .. function nb1() { $.post("p1.php", { action: 1 }, function(data) { console.log(data); }, "json") .fail(function(data) { console.log("error"); }); } function nb2() {...

Set default value for struts 2 autocompleter

jquery,jsp,struts2,struts2-jquery,struts2-jquery-plugin
I have implemented a struts 2 autocompleter in which i have used a list of String like this - <sj:autocompleter id="cityId" cssClass="txtfield8" name="outlet.cityName" list="cityList" autoComplete="true" forceValidOption="false" /> How can I set a default value for this, so that every time it loads, a default value will be shown ?...

How to add an element with jQuery or Javascript

javascript,jquery,html
I want to know how to add an HTML element with jQuery or Javascript after another element for example, from this <ul> <li> .... </li> <li> .... </li> <li> .... </li> </ul> to this <ul> <li> .... </li> <div>..</div> <li> .... </li> <div>..</div> <li> .... </li> <div>..</div> </ul> ...

Click on link next link should be display on same page

javascript,php,jquery,html,css3
I have a single page website and need to link the navigation to IDs in the page. I have three links: "About us", "Our Project", "contact". So if user clicks on "About ", the About section will be displayed, same with other links. Inside Our project there is Two buttons...

writing jQuery instead of $ to access controls in a page

jquery
Can I write jQuery( "body" ).append('Hello') instead of $( "body" ).append('Hello') in jQuery

Identifier starts immediately after numeric literal

jquery,ajax,razor
I'm trying to get the current logged in usersID in my jquery function var userID = @User.Identity.GetUserId(); Many answers on this page say that I have to do something like \"@User.Identity.GetUserId()\" But it dont seem to work, can someone tell me how to fix it. Its for my ajax post....

Jquery parsley validate not working

javascript,php,jquery,ajax,parsley.js
if($("#dataform").parsley().isValid()){ $.ajax({ url : '<?php echo base_url();?>index.php/company/final_review?id=<?php echo $this->input->get('id'); ?>', type : 'POST', data : $("#dataform").serialize(), dataType:"json", beforeSend: function(){ $('#remarks').parsley( 'addConstraint', { minlength: 5 }); }, success : function(data){ console.log(data); } }); } This is my ajax part. The plugin is not validating the field it's submitting the form. The...

Bootstrap toggle doesn't display well when added dynamically

javascript,jquery,twitter-bootstrap
I'm trying to add bootstrap toggle switch dynamically but it does not display well after adding it. Thanks for your help! <input id="TheCheckBox" type="checkbox" data-off-text="Yes" data-on-text="No" checked="false" class="BSswitch"> <p> <a class="btn btn-lg btn-primary" href="#">Display another Toggle</a></p> $('.btn').on('click', function () { $('p').after( '<input id="TheCheckBox" type="checkbox" data-off-text="Male" data-on-text="Female" checked="false" class="BSswitch">' ); });...

angular.js - simplest way to handle click inside controller

javascript,jquery,html,angularjs
is there any better way of handling clicks inside a controller than this? <div ng-controller="SomeController> <a href="/#!/something" ng-click="doTheSame()">link1</a> <a href="/#!/something" ng-click="doTheSame()">link2</a> <a href="/#!/something" ng-click="doTheSame()">link3</a> .. <a href="/#!/something" ng-click="doTheSame()">link99</a> </div> in jQuery I would do something like: $('div > a').on('click', function() { // do some stuff }); ...

Render currency and symbol and combine with data from a different cell

javascript,jquery,datatables
I am working with latest jQuery DataTables v1.10.7 and I am trying to parse a number into the following format: $239.90 USD I am being able make the currency working with this command: columns: [ { data: "Price", render: $.fn.dataTable.render.number(',', '.', 2, '$') }, however the output of this is...

Placeholder in javascript with val()

javascript,jquery,html
I can not understand Javascript language properly, I am trying to write inside placeholder but it is not working, here is my code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>val demo</title> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#myInputText').keyup(function() { $('#myOutputText2').val('placeholder="' + $(this).val() + '"'); $('#myDIVTag').html('<b>' + $(this).val()...

Snap SVG .animate callback fires immediately

javascript,jquery,animation,svg,snap.svg
I am trying to pass a set of arguments to an animate function within Snap SVG including a callback function. However, the callback (in this case is to remove the element) fires immediately on click and not after the animation has completed. As it is now, the element is removed...

Parsing XML array using Jquery

javascript,jquery,xml,jquery-mobile
I have stuck up with an issue of passing XML using Jquery. I am getting empty array while traversing to jquery.Please help me how to get datas from XML array. I have mentioned my code below. XML <?xml version="1.0" encoding="UTF-8"?> <json> <json> <CustomerName>999GIZA MID INSURANCEAND SERVICES PVT LTD</CustomerName> <mobiLastReceiptDate>null</mobiLastReceiptDate> </json>...

jqgrid: Sorting not working after dynamically adding records

javascript,jquery,jqgrid
I have a jqgrid which initially gets populated with some records. User has the option to add more rows to the grid. But, after adding new rows, if user tries to sort the records, the result is inconsistent and some of the records are lost in the grid. Fiddler: https://jsfiddle.net/99x50s2s/68/...

Confused by JQuery Docs about .submit() event

javascript,jquery
I saw a example describe in Official Document https://api.jquery.com/submit/ $( "#target" ).submit(function( event ) { alert( "Handler for .submit() called." ); event.preventDefault(); }); Now when the form is submitted, the message is alerted. This happens prior to the actual submission, so we can cancel the submit action by calling .preventDefault()...

Update input number variable onclick

javascript,jquery,html,function
I am trying to create a calculator style thing, where you put in how many years into a input, you hit submit and it gives you different results below without reloading the page. I have all the calculations working right now, but I just cant get the input number variable...

Get elements containing text from array

javascript,jquery,html,arrays,contains
I want to search all the elements containing any string in the array. For example I have following list of items <ul> <li>cricket bat</li> <li>tennis ball</li> <li>golf ball</li> <li>hockey stick</li> </ul> and this array var arr = ['bat', 'ball']; It should select all the elements having text bat and ball....

Getting generic anchor text on click with angularJS/jQuery returns empty string

jquery,angularjs
I have an anchor generated from a JSON database query result. The anchor represents the title of an article (I have no idea how many articles there will be). I want to be able to get the anchor text (the article title), upon clicking the anchor in order to use...

Adding horizontal space between 2 buttons using javascript

javascript,jquery,html,css
I am dynamically creating submit buttons using javascript. I wanted to know how to introduce horizontal spacing between every other button in the process. My code is var allFields = commonButtons.concat(extraFields); for (var i = 0; i < allFields.length; i++) { var node = document.createElement("input"); var btName = document.getElementById("submit-buttons"); node.setAttribute('data-value',...

If statement for search field in Rails

jquery,ruby-on-rails,search,if-statement
I have a blog site and recently added a search bar for visitors to browse through blog posts. When used, all of the posts go away in the directory and only those which return via the search appear. In order to show the general directory and view all, I would...

Stop propagation to appended element

jquery,html
I append <a> tag to my div : $('<a class="dz-jcrop" href="http://www.google.com" >google</a>').appendTo('.dz-image-preview'); I want to stop propagation for <a> tag .. but when I try just to select the element I can't. I use the following code to log to test if my element is selected : $(document).on('click', '.dz-jcrop', function(){...

How to find the days b/w two long date values

javascript,jquery,date
I have two long dates value. For Ex: 1433097000000 1434479400000 Here i have to find the days between these two by jquery For Ex: 15/06/2015 - 22/06/2015 If it is more than 5 days, I want to get from is 15/06/2016, to is 19/06/2015. It is based on long values...

drop down menu toggle does not work

jquery,html,css,css3
So I am trying to create a dropdown menu using jQuery and I have tried several things. I tried using .hover(), .click(), and mouseenter() for the user's action, but nothing seems to work. I even tried toggle() and slideDown() for the event but nothing shows up on the screen when...

Using jQuery to Popup iFrame from URL

javascript,jquery,html,jquery-mobile,iframe
I have inherited some code and I am trying to add an enhancement that will open a popup style iframe with the URL. The way the code is laid out is there are different tab-panes within the html window and in the "content" tab it displays information in the #post-body...

Dynamically add href based on Class name of parent list item

javascript,jquery,html
I need to add a href attribute to an anchor tag based on the class name of its parent list item. Example: Here is what I need: <li class="prefix_1"><a href="prefix_1">myText</a></li> <li class="prefix_2"><a href="prefix_2">myText</a></li> <li class="prefix_3"><a href="prefix_3">myText</a></li> I should also add that I am dynamically adding the class names to the...

most efficient way to create javascript array out of various php arrays

javascript,php,jquery,arrays
I have a form that a user can submit multiple times, adding different information each time. These form inputs are translated into php $_SESSION arrays, so each time the user hits the submit button, the array grows. This is working fine. I need to bring these over into javascript but...

Using $.ajaxStop() to determine when page is finished loading in CasperJS

javascript,jquery,ajax,phantomjs,casperjs
So far in my tests written in CasperJS, I've been using waitForSelector() on page-specific elements to determine if a page has fully loaded (including all the async ajax requests). I was hoping to come up with a more standard way of waiting for page load and was wondering if the...

What is the slice.call() doing in get() jquery function [duplicate]

javascript,jquery
This question already has an answer here: Explanation of [].slice.call in javascript? 4 answers I am new to jquery and basically, I was just looking at the source of the the get() function in jquery and it looks something like below (Jquery 11.1.3) : get: function( num ) {...

Add CSS3 transitions to jQuery Animate script

javascript,jquery,html,css,css3
Below I have a script that loads images in a random order and flies them onto the screen beside each other. You can find the script here: https://jsfiddle.net/38e126f4/ I would now like to be able to add different random CSS3 transition effects to each image as they fly onto the...

Redraw text over clearRect HTML5 Canvas

jquery,html5,canvas
I'm trying to draw text (HTML5 canvas) depending on what option is selected in a select element. It works correctly until there's 2 set of text that appears at the same place. It seems like the clearRect function is the issue. The text won't be redrawn over that cleared space....

slideToggle state not working with multiple boxes

javascript,jquery,cookies
I'm trying to save the toggle state of collapsable boxes using cookies. Here's my code: HTML: <div class="box_container"> <div class="box_handle"> Title </div> <div class="box" data-title="admin_actions"> Content </div> </div> Javascript: $('div.box_container div.box_handle').click(function() { $(this).next('.box').slideToggle('fast'); }); $.each($('div.box_container div.box_handle'), function(index,value){ if ($.cookie('show_box_' + $(value).next('.box').attr('data-title')) != 'closed'){...

change css dynamically by selecting dropdown list item

jquery,html,css,drop-down-menu
I have the following Dropdownlist with yes or no options-:` <asp:DropDownList ID="ddlchangecss" runat="server"> <asp:ListItem Text="yes">yes</asp:ListItem> <asp:ListItem Text="no"></asp:ListItem> </asp:DropDownList> i want to add a css dynamically like that-: .imgFullWidth { width: 100%; height: auto; float: left; margin: 0px 0px 20px 0px; } when I select yes option in Dropdownlist. How can...

Using GULP to load Jquery CDN and other external JS sources

javascript,jquery,gulp
I've been trying to find a definitive answer to a problem I'm having using GULP to load the latest jquery CDN or any other Javascript CDN external sources. What I've got so far is all our JS files being found in a folder, concatenated to a single file and placed...

Binding Checkbox to td element

javascript,jquery,html
I'm currently developing a web application that populates a table (using the dynatable jquery plugin) using json. One of my needs is to bind a checkbox to a particular column (email) and to be able to retrieve a list of selected addresses and convert them into a comma separated string....

Show and hide select input which is created dynamically

jquery,jsp,show-hide
I want to show a select form (which is hidden), when a checkbox is checked. I have coded this bootply which is working right. However, in my JSP page depending what an object contains, many checkboxes are printed, which all of them contain the .action-do class so, what is happening...

Show only the requested forms using JS

javascript,jquery,html,html5,forms
As the image below illustrates, I have two forms and two buttons. Currently all the forms are visible. How can I only show the requested form "according to the option they have selected (from the blue buttons on the top)"? So, if the user clicked on the "send an invite"...

jqgrid paging on server side

jquery,jqgrid,server,paging
I'm trying to add server side paging to my grid. In adittion, I have a filter by 'license', 'number' and 'group'. When I press the next page button the controller is called and I obtain the data but my grid is reload on page 1 and I cant view the...

why i don't get return value javascript

javascript,jquery,html,json,html5
When i debug my code i can see i have value but i don't get value to createCheckBoxPlatform FN function createCheckBoxPlatform(data) { var platform = ""; $.each(data, function (i, item) { platform += '<label><input type="checkbox" name="' + item.PlatformName + ' value="' + item.PlatformSK + '">' + item.PlatformName + '</label>' +...

want to show and hide text using “this” jquery

javascript,jquery
I want to achieve this effect with this because I have several paragraphs like this so I don't wanna use id for each paragraph <p class="desc_services_subheading"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,...

How to create multiple jquery form fields and insert in mysql database, without using mysql_real_escape_string

javascript,php,jquery,mysql
I need to create dynamic text fields with a button (which simply adds a new row of dynamic text fields). Then I need to INSERT the data in a in the database. I borrowed an example of what I need done from someone else's question, the problem is, it uses...

cross domain ajax form post — How is this allowed?

jquery,ajax
I am using jQuery and jQuery form plugin There is a method in jQuery form plugin ajaxSubmit. You pass a form and then it submits it via ajax and you get a response. I am wondering how this is possible since the form is on a different server than the...

Check for duplicates in JSON

javascript,jquery,json,duplicates
I have a json object: var object1 = [{ "value1": "1", "value2": "2", "value3": "3", }, { "value1": "1", "value2": "5", "value3": "7", }, { "value1": "6", "value2": "9", "value3": "5", }, { "value1": "6", "value2": "9", "value3": "5", }] Now I want to take each record out of that...

Detect when the jQuery UI slider is being moved?

jquery,html,css,jquery-ui
I have this custom video time UI slider to change the time of the YouTube video when scrubbed. My problem is that when the video is trying to load when the user is moving the slider, it causes the handle to jerk around and flip around. What I'm trying to...

How to remove legend from bottom of chart - amcharts

jquery,linechart,amcharts
Can you please help me out to remove the legend (of y-axis data) from the below the line-chart. This is the icon that helps to remove the corresponding line from the line-chart. See inline image...

copy last column of one table to another table based on some condition

jquery,html
I have two tables. I want to take last column of table3 and put in to table4 eg:- table3 Names Process_id total construction 1 1111 construction_1 1 0000 engineering 1 2222 permitting 1 3333 eg:- table4 Names Process_id construction 1005 engineering 1005 permitting 1005 final result of table4 output will...

Why are my jquery script animating at different times?

jquery
My jquery snippets are animating at different times. I want all three to load once scrolled upon, but the first graph is loading before everything else. Here is my code: <div class="container"> <div class="row"> <div class="row-centered"> <div class="col-lg-3 col-centered"> <h1>Increase Sales Time</h1> <div id="myStathalf1" data-startdegree="45" data-dimension="250" data-text="33%" data-info="Sales Time" data-width="30"...

change icon on collapse in Bootstrap 2.3 not in bootstrap 3

javascript,jquery,css,html5,twitter-bootstrap
I am using bootstrap 2.3 collapse in my project. I need to change icons on collapse means on show and hide I need to change icons. with bootstrap 3 some shown and hidden functions are showing in internet but I need with Bootstrap 2.3. Please let me know how to...

How to send current page number in Ajax request

javascript,jquery,ajax,spring-mvc,datatables
I am using jQuery DataTable to display huge amount of data in a table. I am getting data page wise on Ajax request like this: var pageNo = 1; $('#propertyTable').dataTable( { "processing": true, "serverSide": true, "ajax": "${contextPath}/admin/getNextPageData/"+pageNo+"/"+10, "columns": [ { "data": "propertyId" }, { "data": "propertyname" }, { "data": "propertyType"...

How to position div which contains font-awesome icons to centre of another div?

jquery,html,css,css3
I'm trying to position div which contains font-awesome icons to centre of another div but i cannot make it in the right way. I have following code: HTML: <div id="menuRightSide" > <div class="rightSideMenuItem"> <div class="fa fa-facebook fa-2x rightSideMenuItemIcon" ng-click="redirectToGamePage();" id="repeatIcon"></div> </div> <div class="rightSideMenuItem"> <div class="fa fa-twitter fa-2x rightSideMenuItemIcon" ng-click="redirectToGamePage();" id="repeatIcon"></div>...

Modal from inside Bootstrap Tabs using Knockout foreach

jquery,twitter-bootstrap,knockout.js,twitter-bootstrap-3
I have Bootstrap tabs bound to a KnockoutJS observable array using a foreach binding, which is working fine. I now want to launch a Bootstrap modal from inside the active tab. <div class="tab-content"> <!-- ko foreach: trueData --> <div class="tab-pane fade in" data-bind="css:{active: $index() == 0}, attr :{'id': 'tab' +...

Javascript change the souce of all images present inside a string

javascript,jquery
I have a message or string which contain both text as well as images as below. var text = '<span class="user_message">hiiiiiii <img title=":benztip" src="path../files/stickers/1427956613.gif"> <img src="path../files/stickers/416397278.gif" title=":happy"></span>'; Before appending this to the the chat div i want to replace the src of the images to a default image. How can...

Get info from dynamic/growing form

javascript,jquery,html
Have a form to create a contract, where that contract can have one or more users associated. The area to input the users info, starts with only one field of one user, and one button to add more fields if needed. <div id="utilizadores" class="row"> <div id="utilizador1" class="container-fluid"> <div class="row"> <div...

How to remove unmatched row in html table using jquery

jquery,html
I have two tables. I want to delete unmatching rows. Compare with first column in Table1 and compare with first column in Table2. Table1 111 aaa 222 bbb 333 ccc Table2 333 xxx 444 zzz 111 vvv result of Table2 333 xxx 111 vvv I tried some thing here Please...