Search Results

Search found 753 results on 31 pages for 'selectors'.

Page 13/31 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Searching for Nodes with Specific Text using the Prototype Javascript Framework

    - by Alan Storm
    Does the Prototype Javascript library have a selector that's equivalent to jQuery's :contains()? If not, what would what be "The Prototype Way" to selector/filter-down a list of elements that contains a particular string. For example, using the following $$('#some_div dd a') I may get back an array of 50 or so links. I only want the links that contain the work 'home'. In jQuery I'd do this jQuery('#some_div dd a:contains('home')'); Is it possible to do something similar using Prototype? If not, is there an elegant way to filter out the array of 50 elements that gets returned.

    Read the article

  • Finding parent class and id

    - by Breezer
    Well after countless tries i can't get this work? <script type="text/javascript"> $("td input").focusout(function() { var column = $(this).parent('td').attr('class'); var row = $(this).parent('tr').attr('id'); $('#dat').HTML(row+" "+column); }); </script> And the html looks like this <tr class="numbers" id="1"> <td class="a" align="right">1</td> <td class="b"><input class="input" type="text" value=""/></td> <td class="c"><input class="input" type="text" value=""/></td> <td class="d"><input class="input" type="text" value=""/></td> <td class="e"><input class="input" type="text" value=""/></td> <td class="f">0</td> <td class="g"><input class="input" type="text" value=""/></td> </tr> can anyone point me to the right direction on what might be wrong? thanks in advance regards

    Read the article

  • jquery selecting all last elements of an nested tree menu unordered list...not just the :last-child.

    - by Ronedog
    I'm having some trouble figuring this out. I have an unordered list menu that I want to style all the last elements with a folder icon and style all the expandable (parent) elements with a plus.gif image. I wanted to simply change the class by using .addclass() using jquery, which will contain the css to add the background-image. My jquery code below is only selecting the ":last-child", which is placing a folder icon on the last element in the list. i need to place a folder icon in front of all the "li's" that don't hav any children, and place a plus icon in front of all those that do have children. Is there a way to accomplish this? Here's my HTML: <ul id="nav"> <li>Heading 1 <ul> <li>Sub page A <ul> <li>Sub page A - 1 <ul> <li>A - 1: 0</li> <li>A - 1: 1</li> <li>A - 1: 2</li> </ul> </li> <li>Sub page A - 3</li> <li>Sub page A - 2</li> </ul> </li> <li>Sub page B</li> <li>Sub page C <ul> <li>Sub page C - 1 <ul> <li>C - 1: 0</li> <li>C - 1: 1</li> <li>C - 1: 2</li> </ul> </li> <li>Sub page C - 3</li> <li>Sub page C - 2</li> </ul> </li> </ul> </li> <li>Heading 2 <ul> <li>Sub page D</li> <li>Sub page E</li> <li>Sub page F</li> </ul> </li> <li>Heading 3 <ul> <li>Sub page G</li> <li>Sub page H</li> <li>Sub page I</li> </ul> </li> </ul> Here's the jquery code: $(function(){ //add class to last item in each list $('#nav li').find('li:last').addClass('menu_last_child'); });

    Read the article

  • Cufon selector problems

    - by meep
    Hello StackOverflow. I am using Cufon (http://cufon.shoqolate.com/generate/) to replace some text in a menu. Problem is that I only need to style the first <li> of the first <ul>. I have tried using: Cufon.replace('#menu ul li > a', { fontFamily: 'Christopherhand', hover: { color: '#99c635'}}); With the > seperator, but it does not work. It still replaces the #menu ul li ul li a This is my markup: <div id="menu"> <ul> <li class="current"> <a href="#1">About JW</a> <ul> <li><a href="#2">Subpage 1</a></li> <li><a href="#3">Subpage 2</a></li> <li><a href="#4">Subpage 3</a></li> <li><a href="#5">Subpage 4</a></li> </ul> </li> <li><a href="#2">Our Products</a></li> <li><a href="#3">Best Recipes</a></li> <li><a href="#4">Health &amp; Diet</a></li> <li><a href="#5">Our Ads</a></li> </ul> </div> Can anyone see the problem? It should work without adding a class to sub <ul>. :-) Thank you.

    Read the article

  • How can I make jQuery select an element in the style of CSS?

    - by ben
    <div id="id" class="div-style"><img id="1" class="img-style"></div> I would like to use the id attribute as a way for jQuery to select the element, and the class attribute for CSS to style it. My guess for jQuery selector ran thusly: $("#id .div-class") and $("#id .img-class") This returns the error "Selector expected"

    Read the article

  • jQuery: how to create a new div, assign some attributes, and create an id from some other elements a

    - by Ronedog
    jQuery: how to create a new div, assign some attributes, and create an id from some other elements attributes? How can I accomplish this. What I've tried below is not working and I'm unsure how to make it work. What I'm trying to do is create a div and assign it some attributes, then append this div to all the < li elements that are the on the last node of my unordered list. And lastly, but most important I want to retrieve the value of the attribute called "p_node" from the < li that is being appended to and insert it in as part of the ID of the newly created div. Here's my current jQuery code: $('<div />,{id:"'+ $("#nav li:not(:has(li))").attr("p_node").val() +'_p_cont_div", class:"property_position"}').appendTo("#nav li:not(:has(li))"); Here's the HTML before the div creation: <ul> <li p_node="98" class="page_name">Category A</li> </ul> <ul> <li p_node="99" class="page_name">Category B</li> </ul> Here's what I want it to look like after the new div creation: <ul> <li p_node="98" class="page_name">Category A</li> <div id="98_p_cont_div" class="property_position"></div> </ul> <ul> <li p_node="99" class="page_name">Category B</li> <div id="99_p_cont_div" class="property_position"></div> </ul>

    Read the article

  • How to add string to jQuery selector?

    - by Deshiknaves
    I'm trying to select an id that changes on different posts of same page. So the they have been given an id="show_posts_{PostID}" - on the final output the {PostID} is replaced with a number. In the function I need to call $('show_posts_XXXXXX') - XXXXXX being the generated ID. I have stored this ID in a variable called postId. But I can't seem to do this $("'" + "show_posts_" + postId + "'") Can anyone tell me how I can add a string to the end of a selector?

    Read the article

  • jquery selecting all elements except the last per group

    - by Anthony
    I have a table that looks like: <table> <tr> <td>one</td><td>two</td><td>three</td><td>last</td> </tr> <tr> <td>blue</td><td>red</td><td>green</td><td>last</td> </tr> <tr> <td>Monday</td><td>Tuesday</td><td>Wednesday</td><td>last</td> </tr> </table> What I want is a jquery selector that will choose all but the last td of each table row. I tried: $("tr td:not(:last)").css("background-color","red"); //changing color just as a test... But instead of all cells but the last on each row being changed, all cells but the very last one in the table are selected. Similarly, if I change it to: $("tr td:last").css("background-color","red"); the only one that changes is the very last cell. How do I choose the last (or not last) of each row?

    Read the article

  • table cell background color change problem

    - by Mellon
    I work on another guy's code, and I try to change the table cell background color when mouse over the cell, and change back to the original background color when mouse leave. I use the following code: var bgcolor=$(".cell-el").css("background-color") $(".cell-el").hover( function(){ $(this).css("background-color", "#3c3c36")}, //mouse enter, bg-color change function(){ $(this).css("background-color", bgcolor) // mouse leave, bg-color change back }) Things are working fine, EXCEPT that when mouse first time enter the cell, the cell background color is not changed to "#3c3c36", but when mouse leave the cell after first entering and enter in the cell again, the cell's background color changed to "#3c3c36". That's the cell color never change for mouse first enter, after that, everything is working great. What's could be the cause of this problem?

    Read the article

  • Selenium RC: How to assert an element contains text and any number of other elements?

    - by Andrew
    I am using Selenium RC and the PHPUnit Selenium Extension. I am trying to assert that a table row exists, with the content that I expect, while making it flexible enough to be reused. Thanks to this article, I figured out a way to select the table row, asserting that it contains all the text that I expect. $this->assertElementPresent("css=tr:contains(\"$text1\"):contains(\"$text2\")"); But now I would like to assert that a specific radio button appears in the table row also. Here's the element that I would like to assert that is within the table row. (I am currently asserting that it exists using XPath. I'm sure I could do the same using CSS). $this->assertElementPresent("//input[@type='radio'][@name='Contact_ID'][@value='$contactId']"); Currently I have a function that can assert that a table row exists which contains any number of texts, but I would like to add the ability to specify any number of elements and have it assert that the table row contains them. How can I achieve this? /** * Provides the ability to assert that all of the text appear in the same table row. * @param array $texts */ public function assertTextPresentInTableRow(array $texts) { $locator = 'css=tr'; foreach ($texts as $text) { $locator .= ":contains(\"$text\")"; } $this->assertElementPresent($locator); }

    Read the article

  • How Can i click on this element using XPATH in Web driver?

    - by Mike
    Here is the html..... <li> <input type="checkbox" checked="" name="selectedMstrPrivGroupList[9].mstrAuthorities[0].status"/> Add Dexter </li> How will I be able to click on this element. It is a check box. And I want to use XPath as I have close to 30+ checkboxes in the page, so that I can create a generic method and pass only the Webelement.. I tried the following but didn't work. Driver.findElement(By.xpath("//input[contains(.,'Add Dexter')]")).click(); Please help!! Thanks, Mike

    Read the article

  • JQuery: show div on radiobutton select

    - by nav
    Hi, I am trying to use JQuery to show a div when the user selects a particular radio button (Other) within a radiobutton group. The html is below <div id="countries"> <input id="Washington_D.C" TYPE="RADIO" NAME="location" VALUE="Washington">Washington D.C</input> <input id="Other" TYPE="RADIO" NAME="location" VALUE="">Other</input> <div id="other locations" style="display: none"> </div> </div> Using the JQuery code: $(document).ready(function(){ $("radio[@name='location']").change(function(){ if ($("radio[@name='location']:checked").val() == 'Other') $("#county_drop_down").show(); }); }); But its not showing the div 'other locations' when I select the radiobutton'Other'....

    Read the article

  • jQuery selector for option tag value attribute returns null

    - by Ben
    Hello, I am trying to change the selected option in a select dropdown box with jQuery. I have it set so that it finds the hash tag at the end of the URL and based on that hash tag it changes the selected option in the select box. Most of my code is functional, it successfully finds the hash tag and executes the if statement that corresponds with it. However, when it goes to execute the "then" section of the statement when it goes to the selector for the option (which uses an attribute selector based on the value attribute of the option tag) it returns null. If figured this out with firebug, in the console it says that the selector is null. Here is my code: $(document).ready(function() { var $hash = window.location.hash if($hash == "#htmlcss") { $('option[value="HTML/CSS Coding"]').attr("selected","selected") } if($hash == "#php") { $('option[value="PHP Coding"]').attr("selected","selected") } if($hash == "#jscript") { $('option[value="Javascript and jQuery Coding"]').attr("selected","selected") } if($hash == "#improv") { $('option[value="General Website Improvements"]').attr("selected","selected") } if($hash == "#towp") { $('option[value="Website Conversion to Wordpress"]').attr("selected","selected") } if($hash == "#wptheme") { $('option[value="Wordpress Theme Design"]').attr("selected","selected") } if($hash == "#complete") { $('option[value="Complete Website Creation"]').attr("selected","selected") } if($hash == "#server") { $('option[value="Web Server Configuration"]').attr("selected","selected") } }); So to clarify, when I enter in a url that ends in the #php hash tag, for example, the desired action does not occur which would change the "PHP Coding" option to the selected one by using the "selected" html attribute however the selector for the particular option tag returns null. Is there a problem with my syntax or is my code not functioning in the way that I think it should? Thanks very much.

    Read the article

  • jQuery: How would I show/hide these elements?

    - by Shpigford
    Here's my HTML: <ul> <li> <p><label><input type="checkbox" name="permission" value="1" class="permission_check" checked> Joe Schmoe</label></p> <p class="radio_option"><label><input type="radio" name="viewpromote" value="1"> View and Promote</label></p> <p class="radio_option"><label><input type="radio" name="createedit" value="1" checked> ...plus Create and Edit</label></p> </li> <li> <p><label><input type="checkbox" name="permission" value="1" class="permission_check" checked> Bob Smith</label></p> <p class="radio_option"><label><input type="radio" name="viewpromote" value="1" checked> View and Promote</label></p> <p class="radio_option"><label><input type="radio" name="createedit" value="1"> ...plus Create and Edit</label></p> </li> </ul> What I need to do is when a user checks/unchecks the permission_check input, then it should show/hide the radio_option elements for that list item.

    Read the article

  • Adding a div layer on top of a jquery carousel. Tough one.

    - by wilwaldon
    Hey everyone, I have a tough one, well it's tough for me because I'm kinda new to the whole jQuery carousel thing, never built one before this project. Here's my problem. If you go to the TEST SITE you will see a scroller with a blue background about half way down the page. If you mouse onto the "data analytics" slide you should see a black box fade in. Here is my dilemma. I want that black box to be a menu that's connected to the data analytics slide. I've done a mock up for you so you can see what I'm talking about. Here is my scroller code. I'm using jCarousel. <div class="carousel"> <ul> <li> <div id="homeslide1"> testers sdfasdfasdfas asdftjhs iasndkad kasdnf <a href="#" id="#homeslide1-toggle">Close this</a> </div> <a href="#" id="homeslide1-show"><img src="<?php bloginfo('template_url'); ?>/images/home_data_analytics.jpg" width="200" height="94" /></a> </li> <li><img src="<?php bloginfo('template_url'); ?>/images/home_oem_partnerships.jpg" width="200" height="94" /></li> <li><img src="<?php bloginfo('template_url'); ?>/images/home_reporting.jpg" width="200" height="92" /></li> <li><img src="<?php bloginfo('template_url'); ?>/images/home_returning_lost_customers.jpg" width="200" height="92" /></li> <li><img src="<?php bloginfo('template_url'); ?>/images/home_sales.jpg" width="200" height="92" /></li> <li><img src="<?php bloginfo('template_url'); ?>/images/home_service_retention.jpg" width="200" height="92" /></li> </ul> Here is my scroller css /*HOMEPAGE SCROLLER*/ .carousel {!important padding:10px; width: 890px; margin: 0px 0px 0px 26px;} .carousel ul li element.style{height: 94px;} .carousel ul{width: 200px; padding: 5px;} .carouselitem{height: 94px;} .prev{background: url(images/home_left_scroll.png); height: 94px; width: 16px; text-indent: -999px; outline: none; cursor:pointer; float: left;} .next{background: url(images/home_right_scroll.png); height: 94px; width: 16px; text-indent: -999px; outline: none; cursor:pointer; float: right;} .carousel ul li{ padding: 0px 3px 0px 3px; margin: 0px; height:!important 94px; } .home_right_arrow{ width: 16px; float: right;} .home_left_arrow{ width: 16px; float: left;} .homeslide1{ width: 200px; height: 94px;} I've tried all sorts of z-index tricks but can't seem to figure it out on my own. If you solve this riddle I'll buy you a beer if we ever meet up. I'll also give you a high five through the internet. Is there a simple way to do this via jQuery? If so could you point me in the right direction? Thanks so much.

    Read the article

  • Event handler triggered twice instead of once

    - by kwokwai
    Hi all, I am sorry that I have asked two questions in a few minutes. In a html file, I got three child DIV tags in a parent DIV tag: <div id="container"> <div id="frag-123">123</div> <div id="frag-124">124</div> <div id="frag-125">125</div> </div> Now when I click either the three child DIV tags, I will see two alert boxes pop up instead of one: The first alert box will show something like this: frag-123, and the second alert box will show something like this: container I dont know why. I just want to get the ID value of a child DIV, not the one from the parent DIV. <script> $(function() { $("div").click(function() { var imgID = this.id; alert(imgID); }); }); </script> Please help.

    Read the article

  • nth-child doesn't respond to class

    - by Arne Stephensson
    Is it possible to get the nth-child pseudo-selector to work with a specific class? See this example: http://jsfiddle.net/fZGvH/ I want to have the second DIV.red turn red, but it doesn't apply the color as expected. Not only that, but when you specify this, it changes the 5th DIV to red: div.red:nth-child(6) When you specify this, it changes the 8th DIV to red: div.red:nth-child(9) It seems to be one DIV behind. There are only 8 DIV tags in the example so I don't know why nth-child(9) even works. Testing using Firefox 3.6, but in my actual production code the same problem occurs in Chrome. I'm not understanding something about how this is supposed to work, would appreciate clarification. Also, this will change the 6th DIV to red, but what I actually want is for it to change the second DIV.red to red: div.red:nth-of-type(6) And I don't understand why nth-child() and nth-of-type() respond differently, since there are only eight tags of the same type in the document.

    Read the article

  • Jquery: Handling Checkbox Click Event with JQuery

    - by wcolbert
    I can't figure out what is going on here. I have some nested lists of checkboxes that I would like to check when the parent is checked. More importantly, I can't even get the alert to show up. It's as if the click event is not firing. Any ideas? $(document).ready(function() { $("#part_mapper_list input[type=checkbox]").click(function(){ alert("clicked"); if ($(this).attr("checked") == "checked"){ $(this + " input").attr("checked") = "checked"; } else { $(this + " input").attr("checked") = ""; } }); }

    Read the article

  • jQuery show submit button on input field click

    - by Pjack
    Hi, I'm trying to have a comment input field that will show the submit button on a dynamically created form when you click on the input field. Similar to how facebook comments work. When you click on the input field the submit button appears and when you click off it disappears. All the comment input id's are comment_1 etc and the submit button id's are submit_1 etc. I've tried this, jQuery("#[id^='comment_']").live('click',function(event){ if(jQuery("#[id^='comment_']").val() == ""){ jQuery("#[id^='submit_']").hide(); } else { jQuery("#[id^='submit_']").show(); } }); And that won't work for some reason. Any suggestion or how it can be accomplished would be great.

    Read the article

  • Why doesn't $("#RadioButtons:checked").val() work in IE?

    - by Randy Heaps
    Why doesn't $("#RadioButtons:checked").val() - id selector - work in Internet Explorer but $("input:radio[name='RadioButtons']:checked").val() - name selector - does? <input name="RadioButtons" id="RadioButtons" type="radio" value="1" checked> <input name="RadioButtons" id="RadioButtons" type="radio" value="2"> <script> alert($("#RadioButtons:checked").val()); alert($("input:radio[name='RadioButtons']:checked").val()); </script>

    Read the article

  • JQuery Selector - Select this, not that?

    - by JasonS
    Hi, I have created a script which is surprisingly working. (I do not do much JavaScript) What I have is a load of images listed within a div. These images are hidden. JQuery gets the properties of the images and puts them into an array. When the body is clicked, the background image of the page changes. This works nicely. However, I now have a problem. There are several elements which I shouldn't change the background when they are clicked. Namely, navigation, footer and caption. How do I create a selector which makes the body clickable, yet ignores clicks on the above 3 div's?

    Read the article

  • Help with manipulating child/parent elements with jQuery

    - by Mohammad
    Currently I have this JQuery script var img = $(this); img.wrap('<div class="photo"></div>'); img.parent().append("<p>" + img.attr("alt") + "</p>"); which successfully turns the following: <img src="photo.jpg" alt="caption"> into this <div class="photo"> <img src="photos.jpg" alt="caption"/> <p>caption</p> </div> All is well unless the image has a link as a parent; <a href="#"><img since I want it to be correct html (I'm fussy) improving the resulting outcome bellow would be satisfactory <a href="#"> <div class="photo"> <img src="photos.jpg" alt="caption"/> <p>caption</p> </div> </a> to this: <div class="photo"> <a href="#"> <img src="photos.jpg" alt="caption"/> </a> <p><a href="#">caption</a></p> </div> </a> This is my jQuery script so far (which doesn't work bc I'm a noob) aha if(img.parent('a')){ var targetLink = img.parent('a').attr('href').val(); img.parent('a').wrap('<div class="photo"></div>'); img.parent('div').append('<p><a href="'+targetLink+'">' + img.attr("alt") + '</p></a>'); }else{ img.wrap('<div class="photo"></div>'); img.parent().append("<p>" + img.attr("alt") + "</p>"); }; Any advice, or help will be greatly appreciated : ) Thank You! Update *Answer* (works but looks sloppy) I'm editing it atm; if(img.parent('a').length){ var targetLink = img.parent().attr('href'); img.parent().wrap('<div class="photo"></div>'); var divTarget = img.parent('a').parent('div'); divTarget.append('<p><a href="'+targetLink+'">' + img.attr("alt") + '</p></a>'); }else{ img.wrap('<div class="photo"></div>'); img.parent().append("<p>" + img.attr("alt") + "</p>"); };

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >