So I think the best way for me to keep my code is to call a function with a dynamic name. For example, I might need to call "productTemplate", "userTemplate", "orderTemplate", etc...
Is this possible with javascript/jquery? Also, is it a performance hit or not so much?
...
Problem:
Extract all html between two headers including the headers html. The header text is known, but not the formatting, tag name, etc. They are not within the same parent and might (well, almost for sure) have sub children within it's own children).
To clarify: headers could be inside a <h1> or <div> or any other tag. They may also ...
I want to make a kind of user control using javascript.
<div id="myDiv">
<input type="text" id="myText" />
</div>
I want to insert this div in my HTML markup, wherever I required. Purpose is to make it reusable at various places in my HTML and maintain a single point of change, if I need to change the control in future. I would like...
I need to store country, state, city, and county info in Javascript. Example:
Country State City County
USA CA Oakland Alameda
USA CA Markleeville Alpine
USA WA Seattle king
...
CANADA Ontario Toronto ...
The following is a part of my code :
$.post("checkbuddy.php",function(data){
if(data!="a"){
$("#Layer15").css({ visibility: 'visible'});
$("#Layer10").css({ visibility: 'visible'});
$("#Layer10").html(data);
}
});
The condition if(data!="a") doesn't seem to be working, as checkbuddy.php returns "a". And what happens i...
Say you've got a menu that toggles open and closed with a button. My standard way of going about this would be to write the CSS for a closed menu, and write Javascript that specifies (or animates to) an open menu state.
Lately I've gotten into Active.js, a client-side MVC framework. It provides for view classes with builders for making ...
Hi I have a grails variable which is of type JASONList that is rendered in a template
Is there a way to access this list from inside a javascript function.
Lets say I want onresize to fit all the objects on the screen. Without making a db call and re fetching the entire list from ajax ....
Lets say the template does something like ...
I hope my code can explain itself, I am almost there, I just am stuck on the way how to merge optional data into a JSON object with multiple levels (is that even what it is?)
//get video list - example: video1.flv;test23.flv;Grabledable.flv
var files = j('.videos').html().split(';');
// assume first we have one video, so no need of play...
I'm writing a JavaScript for an open source browser available for Android to replace the text in the body tag of the pages loaded into the browser with some different text.
This should be worked in away that once a page get loaded into the browser, this JavaScript executes & the replacements take place & finally the page with replaced ...
Is there any way of determining the id attribute of any html element.
...
I'd like to incorporate whatever shorthand techniques there are in my regular coding habits and also be able to read them when I seem them in compacted code.
Anybody know of a reference page or documentation that outlines techniques?
Edit: I had previously mentioned minifiers and it is now clear to me that minifying and efficient JS-ty...
I am dynamically appending form elements. The newly appended elements need to have distinct name attributes. I am doing this by starting with a base form, grabbing a hidden set of form elements, cloning them and appending them. My problem is that when I go to set the name attribute of the new elements all of the form elements get changed...
How can i write JS function to catching a Reload Button (on browser) then i pressed on.
I want to pop up alert something like that.
etc. -> and back button too.
Thank you.
...
Hi, I'm creating a bookmarklet and everything was going ok. I had a function that loads jQuery asynchronous if the page didn't have it and then load my script or load my script directly if the page had jQuery.
Then I try to use the delegate function which is only available in jQuery 1.4.something. I can check the jQuery version with $()...
Hi to all again , i come today to show an error thrown by opera in Jquery ,about object transformation , here is the code ( function setColor(x,y) ):
colourpixel = $('#colour').css('background-color').match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);//["rgb(0, 70, 255", "0", "70", "255"]
var canvas = document.createElement('canvas');
canvas.h...
I have asked reverse geocoding for 121 place georges pompidou paris, france (where there is an excellent icecream :))
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=121+place+george+pompidou&sll=48.860921,2.351788&sspn=0.000745,0.002637&ie=UTF8&hq=121+place+george+pompidou&hnear=&ll=4...
Hi there!
Could someone explain to me why objectInfo method on the third button returns undefined for the first value? http://jsfiddle.net/PnSSX/11/
I can't figure out where this comes from, because there is no property before name...
Can you help? Am I missing something?
Best regards,
shapeshifta
...
I have an element that I grab the content of and swap for an input, I then want to user to be able to click on the input (to enter text as normal), but if they click anywhere else to swap it back to the text.
However the click event seems to fire even the very first time the user clicks anywhere on the page. My code is below, have I mis...
I want to embed both an ActiveX and NPAPI plugins in one page using nested object tags (as recommended by Mozilla) instead of relying on user agent.
The problem is: I want to use one object id, such as id="MyObject", which will be defined in both object tags (for the ActiveX or NPAPI) so that my Javascript calls the object MyObject dir...
Hi,
I currently know two ways to construct singletons in JavaScript. First:
var singleton = {
publicVariable: "I'm public",
publicMethod: function() {}
};
It is perfect except that it does not have a constructor where I could run initialization code.
Second:
(function() {
var privateVariable = "I'm private";
var privateFunction ...