Tagged Questions
9
votes
3answers
404 views
How to do efficient string concatenations in JS?
I form DOM nodes as strings and append them to DOM tree like below using jquery.
var dom = '<div><div style="display: inline-block">first name</div>'
'<div ...
8
votes
4answers
844 views
Any tips on making this JS better?
Working on a personal project to keep different snippets/examples/small projects of mine organized. I want to make the most of my page width, so I decided to write a navigation menu that slides out. ...
7
votes
3answers
294 views
If I write spaghetti code, I'm gonna have a bad time. Help with this ajax/jquery logic please :)
This is a pretty simple script.
In short it's meant to look for an id in the data attribute in each containment div, then send an ajax call to get the amount of retweets, calculate the karma based ...
5
votes
2answers
849 views
Nested “Select All” checkboxes
So after answering a question about nested linked checkboxes I mentioned it at work and surprisingly it turned out to be similar to something we needed.
The requirements were:
a "Select all" ...
5
votes
2answers
2k views
jQuery plugin $(node).toJSON() - convert html form to JS Object
GitHub project repo
I've been working on this little function to convert an HTML form into a JSON Object having the same structure of the form. Basically it is intended to be useful in those ...
4
votes
2answers
237 views
Simplifying Code for Drop-Down-Box in JQuery and HTML
I'm trying to come up with a way to make a drop down box that is displayed through a jquery mouse hover event and with nested dropdown boxes displayed through hovering over elements of the original ...
4
votes
2answers
68 views
Improving Code pointers
I'm new to jQuery and I've been messing about with this code, It works but I want to learn how to shorten the code by the eliminating unnecessary repeated code.
Below is a link to jsFiddle
...
4
votes
1answer
94 views
This blueprint has already become a mess, please suggest some restructuring
I'm particularly concerned about where I have declared the functions, can I move them around to clean up the code without breaking anything? The "conjugate" function contains a lot of stuff that has ...
4
votes
1answer
147 views
Is there a better way to write my jQuery slider?
First question here so please be gentle. I have developed a jQuery slider and I want to implement it in WordPress (it will be a Featured posts slider).
This is my slider logic:
If there are 1 or 3 ...
4
votes
1answer
121 views
Traversing un-ordered list and appending attibute values to the list item
I have written following JQuery code to traverse the HTML markup pasted below. Basically I am selecting data-icount attribute of each anchor tag and appending it to anchor text as (28) e.g. the ALL ...
4
votes
1answer
2k views
How to exactly work with the JSON Object and jQuery, adding info to posts
I have been working with AJAX and JSON for quite some years now, but to be honest I still do not know exactly what all the functionality are, and how to create optimized code for jQuery.
So my first ...
4
votes
1answer
425 views
DIV mask implemented in JavaScript/CSS
Mask.html
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript" ...
3
votes
4answers
107 views
Get the value of the name attribute of each element with class=“class”
I need a function to get the value of the name attribute of each element with class="class". I was wondering what is the best way to do this, performance-wise.
Currently I'm using jQuery and doing it ...
3
votes
2answers
142 views
Better way to filter select list
I'm brand new to javascript and jquery and I feel like there's probably a better way to do this. It seems that the way I designed it may not be very optimal once you get a thousand entries in the list ...
3
votes
1answer
116 views
JS/Jquery newbie here… Can I please get some advice on improving my code?
You can see the JS at the end of this post in action here at http://andrew-oh.com/portfolio/timeline/ (It's responsive!)
I've recently picked up javascript/jquery and would love some feedback on how ...