How make reusable code in jQuery?

I have code on the link below, and I need to use it several times for any places. I set different value for bars, of course it works wrong. So, the bad answer is set id to each span and copy code for them several times. Please, give me a tip how to ...
more »

2017-01-16 22:01 (2) Answers

Smooth scroll header with fixed position

How to create smooth scroll when I change the position to fixed. I try to add the animation but it does not work. Better use jquery animation(); $(window).scroll(function() { var sticky = $('.mobile-menu'), scroll = $(window).scrollTop()...
more »

2017-01-16 15:01 (3) Answers

Better way to write a reptitive function?

I have code that looks like this: $('.item-one').mouseover(function() { $('.img-one').addClass('fit-img'); }); $('.item-two').mouseenter(function() { $('.img-two').addClass('fit-img'); }); $('.item-three').mouseenter(function() { $('.i...
more »

2017-01-16 13:01 (1) Answers

Get JSON url from textbox?

My script is to get JSON file from url entered in textbox I IDed textbox as txtr and use jquery to get value var txtbval = $("#txtr").val(); and this in json parsing script url: txtbval, But when I clicked on button nothing happen I don't know what...
more »

2017-01-16 06:01 (2) Answers

Replace a paragraph with a city name from JSON

While building a weather app I faced a problem. It has to automatically detect where we based and provide with appropriate temperature and location e.g city name. I'm trying to replace p with a data from JSON. In particular I'm trying to replace para...
more »

2017-01-15 21:01 (2) Answers

Adding css to input fields using jquery

I am creating a form with error messages,When I submit a form with no values it should add icon and change the box color. But I am unable to get error message to the surname field and I am trying to add icon inside the input field using css, couldn't...
more »

2017-01-15 10:01 (1) Answers

PhantomJS not working on javascript page

I'm using PhantomJS + wget to see page content (wich is my goal) on a javascript page. This is the command I use: $ phantomjs save_page.js > page.html beeing save_page.js var system = requ...
more »

2017-01-15 10:01 (2) Answers

Jquery closing on parent click

I want a window to close only when pop_up is clicked (as opposed to clicking div contents). E.g. clicking the background layer hides the div. In the code below I don't want it to close #pop_up when clicking the div contents bot only on "pop_up". Ho...
more »

2017-01-14 21:01 (4) Answers

Select more checkbox by value or id

I have this code, where I want to create a toggle button to select 2 or more checkboxes, for example, "Italy and Germany". I'm trying this code but I can not make it work $(document).on('click', '.checkbox_button', function(e) { var $checks ...
more »

2017-01-14 21:01 (1) Answers

jQuery | .css() Multiple Parameters '-' Error

I have a problem with the .css({}) function in jQuery: I don't know exactly how this function behaves, except for that I understood that I can insert into the {,} symbols as key-value pairs (dictionary), separated by a ,. I've tested it, and it works...
more »

2017-01-14 18:01 (2) Answers

javascript click function is not working

Jscript code part1 part2 When I try to calculate difference between two date picker's values the click function doesn't work. But when I try to do something simple like : document.getElementById("price").innerHTML = "safas"; it works.. I couldn't ...
more »

2017-01-14 12:01 (1) Answers

Save plugin loaded with Ajax to cache

So I'm using this code to change the content of my website and loading specific plugins for each "page": $.ajax({ url: urlPath, type: 'GET', success: loadContent //content and plugins are loaded through this }); Now I noticed it doesn't cac...
more »

2017-01-14 11:01 (1) Answers

Custom focus on elements

I am new user at stackoverflow. I am facing issue to set custom focus on certain elements on We can use or java script functionality. My current page layout I want to focus on first with page load on payment 1 text box then payment...
more »

2017-01-13 13:01 (3) Answers

How to get/set select2 value in vuejs

I am using vuejs and creating/deleting dynamic select, which is working fine. Here is working fiddle : var vm = new Vue({ el: "#app", data: { optionArr: [{id:1,price:100},{id:2,price:200}]...
more »

2017-01-13 12:01 (1) Answers

Ajax JSON empty passing

To all whom it may concern (I am really just trying to reach the "please add more detail" limit) When passing data to the server as below the body is shown as empty. Server // POST method route'/pass', function (req, res) { console.log...
more »

2017-01-13 11:01 (2) Answers

New field on Database user registration

Hi Guys i'm a student and have a problem! Hope someone can help! RingCaptha number get saved in the s_phone_land i try to add a field in the Database for this. I find all this files with s_phone_land File: ring_captcha/index.php I change this f...
more »

2017-01-13 09:01 (0) Answers

jQuery on change trigger twice on select

I have problem with jQuery change connected with select tag. It fire twice, second time returning empty array. jQuery or JS is NOT included twice, already checked. I would be very grateful for any help in this area :) JS $(".select-car").on("c...
more »

2017-01-13 08:01 (1) Answers