Css Selector
Nov 5, 2003
I'm trying to write a piece of javascript to select a particular css file based on the browsers screen resolution. At the moment I've got this:
var ScrnSize;
ScrnSize = screen.width + "x" + screen.height;
switch(ScrnSize) {
case "800x600":
document.write('<link rel="stylesheet" type="text/css" href="style/lowres.css" />');
default:
document.write('<link rel="stylesheet" type="text/css" href="style/hires.css" />');
}
But it always seems to go to the default value no matter what. I'm a newb at javascript,
View 2 Replies
ADVERTISEMENT
Jun 5, 2009
I'm trying to find an example of a country selector (which also provides a state selector if USA is chosen) then you cvan select the city, any samples out there?
View 2 Replies
View Related
Sep 8, 2011
Are there any difference between class selector and ID selector
View 2 Replies
View Related
Jan 26, 2011
I'm trying to create a drop down menu which has several levels. When a level is clicked on, other expanded categories in that level should minimize simultaneously. The trouble I'm having is using a combination of selectors to say 'all divs which match this pattern but not this one'. I've had a look through the selectors API pages
View 1 Replies
View Related
Apr 2, 2011
Just started to dabble with jQuery I can get the id for a clicked element, but how can I retrieve its index number within the class?
Code:
$(".heading").click(function () {
$("#containContent").slideToggle(100);
//window.alert($("#containContent .content").length);
window.alert(this.id);
});
Hopefully I can do this from the 'this' reference without having to backtrack through the id?
View 10 Replies
View Related
Oct 12, 2010
I have a page using Moo Tools with 4 images. What I would like to do is to pass a boolean value to an array that exists outside of the image, but then I need to test to see if all elements outside the array are true. If so then I want to alert the user.
View 1 Replies
View Related
Jul 30, 2010
i use it in a CMS. In my content page, when I insert a floating element, I use it to set the margin around element according to left or right float in this way:
$('#content img[style*="float:left"]).css({
'clear' : 'left',
'margin': '0px 20px 10px 0px'
});
in chrome, mozilla and not-IE browser the selector with (: and/or ;) works but in IE doesn't work. Is there a solution?
View 3 Replies
View Related
Aug 9, 2010
I have a problem that I couldn't solve myself. I have 2 forms. name="form1" and name="form2" In each form, there's the same class names for rows. <tr class="draggable">
What I need to do, is to take the last draggable row in a certain form. $( tr_object + " tr.draggable:last" ) <- returns the last tr with class draggable in whole document. How do I limit It's view/search scope to one of the forms only?
View 2 Replies
View Related
Oct 26, 2010
var string = $('#newItemInput2').val(); // gives me "twats"
But when I try and embed it within an object it doesn't work:
Can a jquery selector not be used as the member of an object?
View 1 Replies
View Related
Mar 20, 2011
this code works for me , but there is something wrong , every time the function loads (every 2.5 seconds )the html is loaded in row [0] cell[0] , and they are stacked above each other . what may be wrong there ?
code :
var searchtable=document.getElementById("searchtable")
var resultscount=0
[code]....
View 2 Replies
View Related
Oct 20, 2011
I am using the contains selector for one element because I do not know the full ID. Since I only need the first element it finds should I be adding something to improve performance?
View 8 Replies
View Related
Jan 25, 2010
On our current project we had an very unexpierenced coworker which wroted an "a" tag as an jquery selector. to better understand what he did see the following working sample:
<html>
<head>
<script type="text/javascript" src="
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
[Code]...
This works in Firefox but not in IE (of course not Yeah we know its wrong, but we dont find a reason for its working in firefox ! can someone explain why this can even work ?
View 1 Replies
View Related
Dec 5, 2011
That's my code:
var main = $("#content_value td:contains('Saque')").next();
alert($("img[title='Ferro']", main).text());
I'm trying to get the img element from the main selector, but it's not working..
[Code]...
View 11 Replies
View Related
Jun 3, 2011
The following code works:
$('#prov_1 .toggleEdit').click(function () {
$('#prov_1 .editable').toggle();
});
When I click on the "toggleEdit" button under #prov_1, the .editable elements in #prov_1 appear/disappear.
Now I want to do this for all prov_N.
$('#prov_' + pid + ' .toggleEdit').click(function () {
$('#prov_' + pid + ' .editable').toggle();
});
does not work. How do I extract or define N, the pid number?
View 4 Replies
View Related
Jun 12, 2009
I have a UL list with hyperlinks in the LIs. When I click on the hyperlink, I want to go up the list, and get the html() within the first LI in the list. I have a ('a') click function that returns the hyperlink as $(this).
Now how do I get up to UL and down to LI? (It's actually more complicated because I really want to go up to a top level UL and down to a top level LI...but let's start here).
When I start with $(this) how can I integrate it into a selector? For example, I can supposedly do ("LI > UL > LI:first"), but can I do ("$(this) > LI > UL > LI :first") or do I do ($(this) "> LI > UL > LI:first") ?
View 4 Replies
View Related
Mar 27, 2011
I am trying to make a sliding panel if you click a button, the only problem is that there are more of this panels on the page. I can make the first one open, but I cant make the one opening wich has the id=id.
[Code]...
View 6 Replies
View Related
Jun 16, 2010
I'm trying to add some functionality to a existing application. I have no control over the input element ids. There are inputs I need to use that have $ in the id <input id='field1$0'>. Trying to use the id selector $('#field1$0') fails (result is undefined).Is this a bug or "by design" in qQuery?Is there a workaround, other than looping thru all inputs to find the ones I need?
View 4 Replies
View Related
Jul 2, 2010
I was developing a very simple application, just for training some Ajax. It works like that:
» I make a search using Ajax and it gives me a list with a lot of cities according to their state;
» After receiving the data, I can only manipulate the first DIV (that contains the city data).
The problem is that the city boxes (DIVs) has the same ID and, when the jQuery function is set (to send the address to an input that will make a search through Google Maps API), it only works for the first DIV. Then, if I search new cities, it works, but the same manner :(
Check out the screenshots:
[url]
[url]
[url]
[url]
So... I can only handle the first DIV among all the anothers, because they have the same ID. I have already tried the .each(), .unique(), creating an array...
View 6 Replies
View Related
Apr 11, 2011
ere is my problem : I want to select all the h2 in my #corps container, except those with a .post-title class.The following selector doesn't work with IE (from 6 to 9). No problem with Chrome, Firefox, Opera.#corps h2:not(#corps h2.post-title)The HTML:
<div id="corps">
<div id="contenu">
<h2>Actualités</h2>
[code]....
View 2 Replies
View Related
Jan 20, 2010
i am creating a simple dynamic menu for my study with the following structure:
[Code]...
now i need to find the correct selector for the mouseout event, because now the submenu disappears if i am getting of the current element (this) of the mainmenu, but i only want it to disappear if it is not anymore over the submenu, or if the mouse goes over another element of the main menu.
View 2 Replies
View Related
Sep 25, 2010
Is it possible to use a variable in a selector? So instead of this:
$("#slider img").hide();
I want something like this
var wrapper = "#slider";
$(wrapper + " img").hide();
But this is just giving me this error:
uncaught exception: Syntax error, unrecognized expression: [object Object]
View 2 Replies
View Related
Apr 7, 2010
Is it possible for example to do:
var selec = 3
$(selec).etc...
and i wont it to have the same meaning as
$("#3").etc.... ?
View 1 Replies
View Related
Jan 27, 2011
I started with jQuery a few days ago and rushed into a principal question. Is it possible to use a selector on a result of a selction made before?
code example (which will not work at all, just try to make clear what I want to achieve):
$(".row").$(".idCell") // in the row result the class idCell is unique
Is it possible to to something like this at all and if yes, how is it done?
What I want exactly to do is that if the user double-clicks on a row I want to return the content of the first cell in order to load another form with data according the selected id.
btw, as a last resort I could manually scan the .html() output of $(.row) but I still believe, that the developers of jQuery thought about this problem and there is a more elegant way to accomplish the task.
View 4 Replies
View Related
Aug 4, 2009
I can use $('p#T1') to select the <p> tag with an id of 'T1'. How would I select that <p> tag if 'T1' were a string? In other words, I'm passing 'T1' into the following function:
function displayitems (myItem) {
// in this case myItem is 'T1'
// I then need to 'select' the <p> tag with the 'T1' (myItem) id.
}
View 2 Replies
View Related
Jul 6, 2010
I would like to bind a set of data inside a repeater and be able to use the selector to select 1 or more then 1 values?
View 8 Replies
View Related
Jan 8, 2011
Let's say I have the following HTML:
<span id="more">
Did you know?
<span>The milky way is round.</span>
</span>
Using
$("#more span").css("border", "1px solid black");
will place a black border around "The milky way is round." If I change the <span> tags in the HTML to <div> tags and issue $("#more div").css("border", "1px solid black"); The same will happen. "The milky way is round" will be framed. However, if I change the <span> tags to <p> tags, as in
[Code]...
View 4 Replies
View Related