Searching for a script, which can do show/hide functions without framework.
Something like:
<span rel="toggle" href="/somelink.html">Title</span>
<div class="toggle">Hidden block</div>
.toggle { display: none; }
Block .toggle should be displayed after clicking on span. Like toggle() on jQuery.
Thanks.
...
Hi all,
We have a client unable to switch a form from POST to GET, at the moment we're tracking form submissions via an event tied to the 'Submit' button.
However, this tracks as a 'completed' form, someone who clicks submit but who might get the form returned with errors.
Normally I'd either AJAXify the form and prevent submission of...
Please have a look at the following:
jQuery(document).ready(function() {
var full_url = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
var part_url = window.location.protocol + "//" + window.location.host + "/domain/shop/";
part_url = part_url + "cat1/";
if (full_url ==...
I dont know how to explain this, so ill do the best that I can.
I have a page that has some simple javascript on it:
<script language="javascript" type="text/javascript">
function clearIt(txtbox, initVal) {
alert('f');
if (txtbox.value == initVal) {
txtbox.value = '';
}
}
function fillI...
Part of a web application I'm developing requires me to create bar graphs to display various information. I figured, if the user's browser is capable, I would draw them using the HTML5 canvas element. I have no problem drawing lines and bars for my graphs, but when it comes to labeling the axes, the bars, or the lines I ran into a snag. ...
I am trying use javascript regular expressions to do some matching and I found a really unusual behavior that I was hoping someone could explain.
The string I was trying to match was: " 0 (IR) " and the code block was
finalRegEx = new RegExp("[0-9]");
match = finalRegEx.exec(str);
except that when I put "\d" instead of "[0-9]" it...
the_styles ? the_styles.appendTo('head'); the_styles=null : the_styles = $('.stylesheet').detach();
Obviously, this isn't valid. Notice the ";" between the appendTo() and the_styles=null. How do I write it on 1 line and still have multiple expressions like that?
...
How do I fade in div content on first mouse movement, like on google.com, using javascript? I don't want it to fade out again.
...
Hi -- I'm looping through items from a database via PHP, attempting to call in an external form to edit each item when clicked. I've written Javascript based on the Prototype framework that gets me mostly there. However, when attempting to select the parent element of the clicked item, after the first successful edit, subsequent edits fa...
Is there anyway to achieve this that works cross-browser? (Keeping solutions to pure JavaScript, HTML, and CSS) I'm using JQuery, so JS in that would be best.
(disabled="disabled" doesn't allow focus)
...
I have the following javascript code, which is doing an image rotation on a website I'm working on. It works correctly in Firefox, but not in Chrome or Safari.
When I run the script console in firebug, it doesn't find an error, but when I run the script console in Chrome, it comes back with the error: Uncaught TypeError: Cannot set pro...
Suppose you created an online game in HTML5/Javascript. All the code would be downloaded into the users browser, and they would run the game.
What is stopping someone from copying the game onto their computer, and injecting functions and modules to cheat? IE, they could write a function that autoaims at the nearest enemy sprite for ex...
I need to be able to comment to an article, but also be able to reply to a comment using the same form. Fairly simple, but how do I know that a user clicked on "REPLY", and know which comment they clicked "REPLY" too? I'd imaging I need to add some attribute to the anchor, but I'm not sure what it should be. I'd like this to be a best...
How can I create a shortcut for Greasemonkey for the firefox bookmarks, or, a shortcut that opens a website?
Sorry,
I want a greasemonkey script that contain some script that bind some key for firefox bookmark
for example, press key 1 = open bookmark 1, and so on
...
I know the mouse can be located by position with the event.clientX and event.clientY features but is there any way to tell which character # of the document the curser is on?
...
Is there any way to display a Calendar Extender popup without using it the traditional way? and the also grabbing the value selected?
Some code that I made up to make it more clear:
<table>
<tr>
<td><input type="text"/></td>
<td><input type="text"/></td>
<td><input type="text"/></td>
<td><input type="text"></td>
</tr>
</table>
$('tab...
I was creating a form validator for a client and ran into this weird error ONLY in Internet Exploder (Explorer) 7/8....
'return' outside of function, line 1, char 1
Of course, there was no code whasoever on line 1, it was a simple commented statement. And there was nothing wring with it in any way. So I knew it was just a debug miss-di...
Can I do
<div class="some_div">some div</div>
<script>
jQuery('.some_div').data('some_data','some info').remove();
</script>
where the information is added with data's method, is still around the DOM? Do I need to uninitialize? Is the information automatically removed when the div element has no references left?
...
I'm trying to make an HTTP Get request using JQuery, but I get an empty string as a response, so I figure I'm doing something wrong. I used the documentation from http://api.jquery.com/jQuery.get/ as a guide.
My code looks like this
$.get("http://www.last.fm/api/auth/?api_key=xxxkeyxxx", function(data){
window.console.log(data);
...
Hi all,
This is a question for general discussion. Are there any good, comprehensive resources for useful JavaScript design patterns. I am trying to avoid references that attempt to coerce JavaScript into, say, Java by imposing patterns more suited to another language. Let's let JS be JS and shape our patterns around the strengths.
Ple...