I am basically trying to create a small registration form. If the username is already taken, I want to add the 'red' class, if not then 'green'.
The PHP here works fine, and returns either a "YES" or "NO" to determine whether it's ok.
The CSS:
input {
border:1px solid #ccc;
}
.red {
border:1px solid #c00;
}
.green {
border:1px s...
I need to set equal height on a series of divs inside another div wrapper. The problem is that I dont want the same height on all of them. The page kind of have 3 columns and the floating divs can be 1, 2 or 3 columns wide. The divs float left, so the following example will give me three rows of divs in my wrapper. How can I set equal he...
I want to be able to match against all elements in a given context including the context element itself.
Here is the code I'm using currently, but it seems inefficient. Is there a better way?
Note: I'm using jQ 1.3.2, but I'll upgrade soon so I'm interested in 1.4 solutions too.
var context = $('#id');
var filters = '.class1, .class2...
http://steph.net23.net/work.php here is my test link. This page has a jquery script in it that adds a class to the first image. This works in all browsers except Chrome. It's like it adds it and then the image disappears. Anybody know why?
...
I have multiple menues on my page...
<div class="menu">
<div>Menu header</div>
<div>Menu content</div>// should hide on click outside .menu
</div>
<div class="menu">
<div>Menu header</div>
<div>Menu content</div>// should hide on click outside .menu
</div>
basically i need all the menu(s) to hide when a click is detected ...
var $container = $('div#myContainer');
var $panels = $('div#myContainer > div');
Is it possible to reuse the selector I've already cached in $container within the next child selector?
...
I have a jQuery selector that is running way too slow on my unfortunately large page:
$("#section").find(":visible:input").filter(":first").focus();
Is there a quicker way to select the first visible input without having to find ALL the visible inputs and then filtering THAT selection for the first? I want something like :visible:inpu...
I'd like to remove all matching elements, but skip the first instance of each match:
// Works as expected: removes all but first instance of .a
jQuery ('.a', '#scope')
.each ( function (i) {
if (i > 0) jQuery (this).empty();
});
// Expected: removal of all but first instance of .a and .b
// Result: removal of *all* ins...
Hello
Which is better way to use jQuery? I've heard that jQuery(element) doesn't ruin code in e.g. Wordpress. But $ is easier and faster to write.
Which one do you prefer and why?
Martti Laine
...
$(".box :text").tooltip({
//do stuff
}
now it works well for selecting :text areas under box classes however I also want to include :password areas aswell. How can I combine selectors without writing 2 seperate selectors and execute 2 different methods?
...
I have few nested DIVs at page. I want to add event only for smalest DIV which size is more than 100x100 px.
I am able to do it using conditions in code.
Is it possible to do using selector?
$('?????').click(function (e) {
}
If yes, please provide an example.
...
I'm trying to do the following in jquery but can't make it work .
I want to select all the DIV tags that have a custom attribute called NODE_ID that have a value of 49_3. then select the and change the src attribute to a different image.
Here's the HTML:
<div style="display: block;" id="71_7_sub_p_div" node_id="49_3">
<span>
...
Hi,
I have a working selector but I just wondered whether there was another way I could write it. Here's the html structure:
<ul class="TopList">
<li class="headTitle">
<a href="#">THIS IS TEXT I WANT TO SELECT</a>
<ul>
<li id="list1">item 1</li>
<li id="list2">item 2</li>
...
I want to be able to select the div next in line (its not a child div, or a parent div) more like a sibling. Then I want to get the node_id from that div and parse it. For example, below I know the "NODE_ID" of the first one, so I can use a jquery selector to get that node_ID, then I want to move directly beneath that DIV and retrieve ...
I want to select an element based on it's class and id, I have seen many similar questions on SO. Most of the users ask why would you ever want to do this - which is not very helpful, trust me, this is the simplest way of solving my UI problem, and it's a very unique and intereting UI related to making generic triple stores easily browsa...
All,
in the below code How to edit the current added value.i.e, in the edit function how to get the value in td .Also how can we check for duplicates.
<script type="text/javascript">
function edit(obj)
{
// var ele= obj.parentNode ;
alert(obj.innerHTML);
var htm = '<textarea name="modal" id="modal" rows="10" ...
<script>
function edit(elem)
{
var ele=$(elem).siblings('label#test').html();
var a=document.getElementById('test');
var htm = '<input type="text" name="modal" id="modal" style="width:70%;" value="'+$(elem).siblings('label#test').html();+'"/>';
$dialog.html(htm)
.dialog({
autoOpen: true,
position: 'center' ,
...
Suppose a HTML markup like this:
<ul>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li><!-- I want to select only this -->
</ul>
Would it be possible to select only the third list item in the unordered list element? I've been browsing the jQuery documentation but I can't find any selector that could do this.
...
Hello,
I have html like so:
<div class=foo>
(<a href=forum.example.com>forum</a>)
<p>
Some html here....
</div>
And I want to insert another link after the first one, like so:
<div class=foo>
(<a href=forum.example.com>forum</a>) <a href=blog.example.com>blog</a>
<p>
Some html here....
</div>
...but because it is enclo...
I want to hide all the descendents of the "ul" for my tree menu when the page loads up, then as each "main" "li" link is clicked display the direct child, and if the direct child has children (grandchild), when the the "Child" is clicked I want it to show the "grandchild" elements. should be simple, but some how I screwed things up and w...