So i have a unordered list, each item in the list has a button that is suppose to toggle the post comment textarea. Unfortunately with my first attempt when u click on one Post Comment button all textareas open, then i tried to use this to make sure only one element is selected. Here is the code:
<ul class="todosDisplay">
<li><span>Con...
I'm working on a CSS file and find the need to style text input boxes, however, I'm running into problems. I need a simple declaration that matches all these elements:
<input />
<input type='text' />
<input type='password' />
... but doesn't match these ones:
<input type='submit' />
<input type='button' />
<input type='image' />
<inp...
Hi everyone,
I am just wondering whether that is a correct syntax in JQuery :
var elements = $("#contact-area input[type=text,value=something] ").get();
What I mean is how to write specify more than one parameter to and filter apart from this use :
$("#contact-area (input[type=text],input[value=something])").get();
...
Seems to me the most important yet tricky thing to get right when writing jQuery is the selector.
What tips do you have for writing an accurate selector?
...
i got help (http://stackoverflow.com/questions/1553601/jquery-select-a-tag-with-selector-from-a-text-veriable) on looping the static var and replacing it value, but just one question is left from it, is how can i replace finded tags with newly changed tags in the text area
Code:
var length = 30;
var end = '...';
var text = `some st...
Hi there!
I'm in a bit of a dilemma. I need to select div tags based on whether their children have a certain class. This is a code example of the DOM structure:
<div id="container">
<div id="one">
<p>This is item one</p>
<p class="special">This is a description</p>
</div>
<div id="two">
<p>This...
Which of these two is better/faster?
var a = $('.listItem', $('#myList'));
vs
var a = $('#myList .listItem');
...
I'm writing an html page with some jQuery for style. So I have the following:
$("table tr:odd td").css({"background-color":"rgb(233,247,255)"});
This makes every other row bluish. But just now, I put a table inside one of the cells. What happened? Well, it treated the row of the inner table as if it was a row in the outer table, and t...
jQuery
$("#myID").each(function() {
$(this).dosomething;
});
HTML:
<div id="myID">
<div class="myClass">content</div>
</div>
How do I access myClass from the function? this>myClass ?
...
I have a jQuery script that selects all IDs with 'Phone' in them. However, I have a small part that needs to NOT select them if they are in a class.
What I have, according to the way I understand it is this:
$("[id*='Phone']:not('referencePhones')").doSomething();
What am I missing?
.referencePhones is a parent class. ie:
div cla...
Hey guys, I'm trying to make a small addition to a web app I use. Right now I am trying to check all of the checkboxes on the page which have class .checkBox (In case it is needed to differentiate/select). The checkboxes are descendants of divs of class .someClass, it's just that there are many divs which have that class. I want to check...
I'd like two different HTML elements that are at the same nesting level to have identical CSS property values. Is there an alternative to this wasteful syntax?
.level1 .level2 .level3 element1 { /*rules*/ }
.level1 .level2 .level3 element2 { /*rules*/ }
I was thinking
.level1 .level2 .level3 element1, .level1 .level2 .level3 element2...
I want my links not to have the weird outline and the best way I found to solve this is have a "null link" to focus on after a click. This works great when defining the onclick method inline the HTML but that is not ideal. I wrote a quick jQuery snippet to do this instead, but I am having trouble getting it to work. Here it is:
<scri...
Hello,
Somewhat new to jQuery, so excuse the attempt at properly identifying things.
I need an element's id to be reflected in a selector that is a couple functions deep, and I'm not quite sure how to go about doing that.
$("input[type='file'][id^='pic_']").change( //I need this element's id...
function()
{
$("."+this.id).hi...
Lately i have been wondering if there is a performance difference between repeating the selector just over and over again or just using a var and store the selector in that and just refer to it.
$('#Element').dothis();
$('#Element').dothat();
$('#Element').find('a').dothat();
or just
var Object = $('#Element');
Object.dothis();
O...
I have the following code :
$(document).ready(function() {
var hash = window.location.hash.substr(1);
var href = $('#nav li a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #content';
$('#content').load(toLoad)
}
});
$('#nav li a').click(f...
ok, im trying to animate something to different heights if a selected id has a selected class.
i have the following code.
function myfunction() {
if ($('#homebutton').hasClass("active"));
{
$('#content').animate({height: "240px",opacity: 1}, 100 , hideLoader());
}
if ($('#showbutton').hasClass("active"));
{
$('...
I'm trying to find out the index number of the last list item but the jquery I'm using keeps returning -1. This is the JS and the html that I'm using.
var index = $('#imageThumbnails li:last').index(this);
<div id="imageThumbnails">
<ul class="gallery_demo_unstyled">
<li class="active"><img src="test-img.jpg" width="394" heigh...
Hi I'm trying to make a function that will add a striped effect to an unordered list, I've got the following so far but cant work out how the selector should work.
(function($) {
$.fn.stripe = function(){
this.$("li:even").css("background-color","#f00");
};
})(jQuery);
$("list_id").stripe();
thnks
...
I've never had this issue before, so I'm somewhat lost. I'm getting two different results using essentially the same underlying code. The first way is this:
$(".myClassSelector").append(somejQueryObject);
The second way, which doesn't appear to work the same, is this:
$(".myClassSelector").each(function() { $(this).append(somejQueryO...