This is html code:
<a class="cat" href="#">category</a>
<span class="kiti" style="position:absolute; padding:5px; margin-left:-18px; display:none; background-color:#000">
<a href="#">sub1</a>
<br /><a href="#">sub2</a>
</span>
And functions...
What would be the easiest way to allow only letters/numbers in a textbox. We are using JS/jQuery, but don't want to use a validation plugin?
...
This issue is specifically with Safari.
<div id="list">
<ul>
<li onclick="do_something();"><!-- block with stuff in it --></li>
</ul>
</div>
When the above is loaded normally, the onclick applies to the entire li block. The problem is, later on when I use ajax to populate the #list div dynamically...
$("#list").html('...
I have a small jQuery script that gets information by looking at an ID.
What is the best way to prevent that the same data are requested more than once (e.g. what's the best practices for caching in jQuery)?
I have tried to use $.post and $.ajax with option "cache" set to true, but the request is being sent more than once.
Is it bette...
In my functions.js I have:
$(document).ready(function() {
$("#cat").hover(function() {
$("#kiti").show();
})
$("#kiti").mouseout(function() {
$("#kiti").hide();
})
})
Html file:
<a id="cat" href="#">category</a>
<div id="kiti">
<a href="#">sub1</a>
<br /><a href="...
ive got this function and it works to select text on click
function select_text(ev) {
if (this.createTextRange)
{
// This is for IE and Opera.
range = this.createTextRange();
range.moveEnd('character', this.value.length);
range.select();
}
else if (this.setSelectionRange)
{
// ...
I've been doing some development using the xVal framework for .NET to link up some of the validation rules for models on the server side along with some client side validation using the jQuery Validation plugin along with the jQuery Form plugin for submitting the form.
The scenario is the following:
Allow the client to perform basic v...
This is my index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css" media="all">
<script type="tex...
So I have a page with little picture thumbnails on it and one big area in the middle of the page for full size photo.
When user clicks on a thumbnail, a full size picture is shown in the middle of the page. I just change the src attribute of the image in the middle like this to achieve that:
$('img#fullsize').attr('src', path); // path...
Hello, I'm using a simple piece of code
$("container").load(url, function(){ callback();})
to replace the content of a div container using jQuery's AJAX functionality. That appears to work well with Internet Explorer, however after trying to view it through Firefox I am getting some unexpected behaviour.
The page is fetched and plac...
I have the following script at the end of my page:
<script type="text/javascript">
jQuery.noConflict();
jQuery(function() {
jQuery('#optElem').change(function(){
jQuery.post('http://example.com', { 'id1': 1, id2 : jQuery(this).val() },
function(data){
jQuery('#abc').html(da...
So far, I've seen (and I'm using the following) scripts to show/hide a div or other controls depending on another control in ASP.NET
$('[id$=myRadio_0]').click(function() { $('[id$=myDiv]').show(); });
$('[id$=myRadio_1]').click(function() { $('[id$=myDiv]').hide(); });
and of course, my div in html like
<div id="myDiv" runat="serve...
I need to position an element in the exact centre of the page (using fixed positioning) and need to calculate the expected size. For example I would add HTML like this:
<div class="window" style="left: X; top: Y">
<h3 class="title">Title</h3>
<img src="file.jpg" width="300" height="200" />
<div class="controls">Some stuff</d...
I've been working on a little experiment where, as you scroll, new entries are loaded onto a page.
You can see a practical example here.
Now, if you look at this Firefox everything works as it should. As you scroll towards the bottom of the page entries start to load but only one-by-one. View it in WebKit and instead it will start to l...
Hey guys,
here is my html output:
<script language="javascript">
function append_suggestion() {
$('input[name="cn"]').append($('#rand-character').val());
}
</script>
<form name="form" action="/search/results" method="get" class="search-form" id="search-autocomplete">
<input size="28" class="search-field" id="cn" name="cn" typ...
When a button is clicked it needs to look before its ocurance and find a specific span tag. Unfortunately it is either not finding the tag or not changing it's contents.
This is the code that doesn't work.
$(this).prev("span[id*=CommentText]").hide();
I can set the colour during the load event but when the link is clicked it won't m...
The normal behavior for the jQuery qTip plugin is to create a new hidden div for every tooltip item assigned. Is there a way to tie a single hidden tooltip element to multiple targets, to avoid cluttering the DOM?
Contrived Example:
<div id="foo1"></div>
<div id="foo2"></div>
<script> $("#foo1,#foo2").qTip({"content":"test"}); </scrip...
I have a lot of code in the admin area of my site that is, basically just CRUD operations using AJAX posting.
I was wondering if you had any tips on refactoring these type of functions either into generic functions or classes etc.
Here is some sample code, though a lot of this is duplicated in other functions with just different ajax p...
On a php page with javascript (jquery) in the urel I would like to have something like this
idex.php?var=something*#a=1380369&i=23007472*
The page will load photos and have a next and previous link, when this is clicked on it will use ajax to load the new image into the page but I need to also change the URL to add someting like this ...
Hi all:
I want to insert a function before the DOM or jQuery's document.ready loads in my JsTestDriver test file. I tried inserting it in the setUp function, but upon alerting the length of document.ready list in the first line of code, the document.ready has already been loaded. I have tried inserting tags to it, but JsTestDriver doe...