Search Results

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

Page 2/31 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • jQuery: select all inputs with unique id (Regex/Wildcard Selectors)

    - by d3020
    I have some textboxes on a webform that have ids like this: txtFinalDeadline_1 txtFinalDeadline_2 txtFinalDeadline_3 txtFinalDeadline_4 In my jQuery how do I find all of those in order to assign a value to them. Before I had the underscore and they were all named txtFinalDeadline I could do this and it worked. $(this).find("#txtFinalDeadline").val(formatDate); However, that was when they were all named the same thing. Now I have the _x after the name and I'm not sure how to go about assigning that same value as before to them. Thanks.

    Read the article

  • jQuery selectors - parental problems

    - by aressidi
    Hi there, I have an emote selector that opens up when a user clicks an entry in a diary. The way I've worked it is that the emote selector panel lives hidden at the top of the page. When a user clicks on the 'emote control' associated with an entry, I use JavaScript to grab the HTML of the emote selector panel from the top of the page and insert it next to the entry. Using Firebug, here's what the finished product would look like in the page (snippet from element inspect). I'm trying to get the ID for the class 'emote-control-container' which contains the entry id: <td> <div id="1467002" class="emote-select emote-default">&nbsp;</div> <div class="emote-control-container" id="emote-controls-1467002"> <div id="emote-control-selector"> <div id="emote-control-selector-body"> <ul> <li id="emote-1"><img src="/images/default_emote.gif?1276134900" class="emote-image" alt="Default_emote"></li> <li id="emote-2"><img src="/images/default_emote.gif?1276134900" class="emote-image" alt="Default_emote"></li> <li id="emote-3"><img src="/images/default_emote.gif?1276134900" class="emote-image" alt="Default_emote"></li> <li id="emote-4"><img src="/images/default_emote.gif?1276134900" class="emote-image" alt="Default_emote"></li> </ul> </div> <div id="emote-control-selector-footer"> &nbsp; </div> </div> </div> </td> I need the entry ID along with the emote ID to make a post via AJAX when a user selects an emote from the selector panel by clicking on it. I'm able to get the emote ID just fine with this, which I'm using to alert-out the selected emote ID: jQuery('li').live('click', function(e) { e.preventDefault; var emoteId = this.id; alert(emoteId); }); I'm having trouble traversing up DOM to get the element ID from '.emote-control-container. I've tried everything, but I'd expect this to work, but it doesn't: jQuery('li').live('click', function(e) { e.preventDefault; var entryId = jQuery(this.id).parent(".emote-control-container").attr("id"); alert(entryId); }); What am I doing wrong.? I can't target the ID of the .emote-control-container.

    Read the article

  • Jquery selectors question

    - by Ben
    Hi all, I am not an expert at jquery but trying to get a menu to work. Basically, I have a menu made of up to 3 levels of nested lists. The first level has a little arrow has a background image that opens or close when opening the first level list. Any other nested lists don't need to have the background image. My script opens the menu when you click on it and is also supposed to switch the first level list from a class "inactive" to a class "active". Here is the script: $(document).ready(function(){ $("#left-navigation-holder ul.level1 li.inactive").toggle(function(){ $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); $("#left-navigation-holder li a").click(function(){ menu = $(this).parent('li').children('ul'); menu.toggle(); }); }); The problem is that the toggle function also happens when clicking on second and third level lists causing the arrows to toggle even if the first level list isn't clicked on. I thought using $("#left-navigation-holder ul.level1 li.inactive").toggle would limit the function to the first level list with a class "inactive". Any help would be really appreciated. Ben

    Read the article

  • callbacks via objective-c selectors

    - by codemonkey
    I have a "BSjax" class that I wrote that lets me make async calls to our server to get json result sets, etc using the ASIHTTPRequest class. I set it up so that the BSjax class parses my server's json response, then passes control back to the calling view controller via this call: [[self delegate] performSelectorOnMainThread:@selector(bsRequestFinished:) withObject:self waitUntilDone:YES]; ... where "bsRequestFinished" is the callback method in the calling view controller. This all worked fine and well until I realized that some pages are going to need to make different types of requests... i.e. I'll want to do different types of things in that callback function depending on which type of request was made. To me it seems like being able to pass different callback function names to my BSjax class would be the cleanest fix... but I'm having trouble (and am not even sure if it's possible) to pass in a variable that holds the callback function name and then replace the call above with something like this: [[self delegate] performSelectorOnMainThread:@selector(self.variableCallbackFunctionName) withObject:self waitUntilDone:YES]; ... where "self.variableCallbackFunctionName" is set by the calling view controller when it calls BSjax to make a new request. Is this even possible? If so, advisable? If not, alternatives? EDIT: Note that whatever fix I arrive at will need to take into account the reality that this class is making async requests... so I need to make sure that the callback function processing is correctly tied to the specific requests... as I can't rely on FIFO processing sequence.

    Read the article

  • Jquery Selectors not working

    - by Breezer
    I use the following selector to get the value out of an input that's inside a table but it doesnt work properly? var kom =$("tr#1 .b input").attr(value); and row looks as follow <tr class="numbers" id="1"> <td class="a" align="right">1</td> <td class="a" align="left">Tue</td> <td class="b"><input class="input" type="text" title="" value=""/></td> <td class="c"><input class="input" type="text" title="" value=""/></td> <td class="d"><input class="input" type="text" title="" value=""/></td> <td class="e"><input class="input" type="text" title="" value=""/></td> <td class="f">0</td> <td class="g"><input class="input" type="text" title="" value=""/></td> </tr> any suggestion on what i might be doing wrong any aid is greatly appreciated regards breezer

    Read the article

  • Does duplicate id's screw up jquery selectors?

    - by Matt
    If I had two divs, both with id="myDiv" Would $("#myDiv").fadeOut(); fade both divs out? Or would it fade only the first/second? Or none at all? How do I change which one it fades out? Note: I know duplicate id's is against standards but I'm using the fancybox modal popup and it duplicates specified content on your page for the content of the popup. If anyone knows a way around this (maybe I'm using fancybox wrong) please let me know.

    Read the article

  • How do I remove elements from a jQuery wrapped set

    - by Bungle
    I'm a little confused about which jQuery method and/or selectors to use when trying to select an element, and then remove certain descendant elements from the wrapped set. For example, given the following HTML: <div id="article"> <div id="inset"> <ul> <li>This is bullet point #1.</li> <li>This is bullet point #2.</li> <li>This is bullet point #3.</li> </ul> </div> <p>This is the first paragraph of the article</p> <p>This is the second paragraph of the article</p> <p>This is the third paragraph of the article</p> </div> I want to select the article: var $article = $('#article'); but then remove <div id="inset"></div> and its descendants from the wrapped set. I tried the following: var $article = $('#article').not('#inset'); but that didn't work, and in retrospect, I think I can see why. I also tried using remove() unsuccessfully. What would be the correct way to do this? Ultimately, I need to set this up in such a way that I can define a configuration array, such as: var selectors = [ { select: '#article', exclude: ['#inset'] } ]; where select defines a single element that contains text content, and exclude is an optional array that defines one or more selectors to disregard text content from. Given the final wrapped set with the excluded elements removed, I would like to be able to call jQuery's text() method to end up with the following text: This is the first paragraph of the article.This is the second paragraph of the article.This is the third paragraph of the article. The configuration array doesn't need to work exactly like that, but it should provide roughly equivalent configuration potential. Thanks for any help you can provide!

    Read the article

  • How do I remove descendant elements from a jQuery wrapped set?

    - by Bungle
    I'm a little confused about which jQuery method and/or selectors to use when trying to select an element, and then remove certain descendant elements from the wrapped set. For example, given the following HTML: <div id="article"> <div id="inset"> <ul> <li>This is bullet point #1.</li> <li>This is bullet point #2.</li> <li>This is bullet point #3.</li> </ul> </div> <p>This is the first paragraph of the article</p> <p>This is the second paragraph of the article</p> <p>This is the third paragraph of the article</p> </div> I want to select the article: var $article = $('#article'); but then remove <div id="inset"></div> and its descendants from the wrapped set. I tried the following: var $article = $('#article').not('#inset'); but that didn't work, and in retrospect, I think I can see why. I also tried using remove() unsuccessfully. What would be the correct way to do this? Ultimately, I need to set this up in such a way that I can define a configuration array, such as: var selectors = [ { select: '#article', exclude: ['#inset'] } ]; where select defines a single element that contains text content, and exclude is an optional array that defines one or more selectors to disregard text content from. Given the final wrapped set with the excluded elements removed, I would like to be able to call jQuery's text() method to end up with the following text: This is the first paragraph of the article.This is the second paragraph of the article.This is the third paragraph of the article. The configuration array doesn't need to work exactly like that, but it should provide roughly equivalent configuration potential. Thanks for any help you can provide!

    Read the article

  • Repurposing CSS Class Selectors

    - by limefartlek
    I don't know what this technique is called, I've only seen it used. It's a way to repurpose the same selectors with CSS. For example if I create h1 { font-size:18px; color:#FFFFFF; font-family:Arial, Helvetica;margin:0; padding:0; } h2 { font-size:18px; color:#000000; font-family:Arial, Helvetica; font-weight:normal;margin:0; padding:0; } I can repurpose the h selectors with something like .whatever h1 { color: #000; font: 2.0em arial, sans-serif; background-color: #fff3ea; margin: 50px 0px 0px 50px; } .whatever h2 { color: #000; font: 1.7em bold arial, sans-serif; background-color: #fff3ea; margin: 25px 0px 25px 75px; } If h1 and h2 appear inside of a div called whatever, then they will assume those properties. You can do this with ID tags and class tags but I can't for the life of me remember how this is done. Any thoughts?

    Read the article

  • Use CSS Selectors with HtmlUnit

    - by kerry
    HtmlUnit is a great library for performing web integration tests in Java.  But sometimes node traversal can be somewhat cumbersome. Fear not fellow automated tester (good for you!).  I found a great little project on Github that will allow you to query your document for elements via css selectors similar to jQuery. The project is located at https://github.com/chrsan/css-selectors.  You can use Maven to build it, or download 1.0.2 here.  Beware.  I will not be updating this link so I suggest you download the latest code. In any case, you can use it like so: // from HtmlUnit getting started final WebClient webClient = new WebClient(); final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net"); final DOMNodeSelector cssSelector = new DOMNodeSelector(page.getDocumentElement()); final Set elements = cssSelector.querySelectorAll("div.section h2"); final Node first = elements.iterator().next(); assertThat(first.getTextContent(), equalTo("HtmlUnit")); The only problem here is that the querySelectAll returns a Set<Node>.  Not HtmlElement like we may want in some cases.   However, if you were to reflect on the Set, you would find that it is indeed a Set of HtmlElement objects. Typically, I like to create a base class for my web tests.  Just for fun, I am using the $ method similar to jQuery. public class WebTestBase { protected WebClient webClient; protected HtmlPage htmlPage; protected void goTo(final String url){ return (HtmlPage)webClient.getPage(url); } protected List $(final String cssSelector) { final DOMNodeSelector cssSelector = new DOMNodeSelector(htmlPage.getDocumentElement()); final Set nodes = cssSelector.querySelectorAll("div.section h2"); // for some reason Set cannot be cast to Set? final List elements = new ArrayList(nodes.size()); for (final Node node : nodes) { elements.add((HtmlElement)node); } return elements; } } Now we can write tests like this: public class LoginWebTest extends WebTestBase { @Test public void login_page_has_instructions() throws Exception { goTo(baseUrl + "/login") assertThat( $("p.instructions").size(), equalTo(1) ); } }

    Read the article

  • protecting css selectors on large website

    - by Tim
    I have content that appears within a corporate website inside an iframe. Several departments contribute their own CSS files to manage the overall UI and design. My problem is that they may use selectors for elements like td (for instance), without notice. Of course that will affect my own content in the frame unless I add a class to every td. I'm just using td as an example: the generic style for any element could change without notice. Is there any method/convention/practice I can use to protect my own styling?

    Read the article

  • How to select text, but not images, in CSS

    - by thinkswan
    Simple question: I have the following markup... <a href='#'> <img src='icon.png'> This is the link </a> I want to have the text become underlined on mouseover. What is the CSS selector for selecting only the text in that <a> element and nothing else? I'd rather not wrap it in anything if I don't have to. a:hover { text-decoration: none; } a:hover <select_text_here> { text-decoration: underline; }

    Read the article

  • Selector and Iterating Through a Table Within a Div

    - by GregH
    I have been working on this and cannot get this iterator to work. I have the following HTML and am trying to iterate through all rows (except the first row) and extract the values in cells (td) 2 and 3 : <div id="statsId"> <table width="220" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td width="65"/> <td width="90"/> <td width="65"/> </tr> <tr style="font-weight: bold;"> <td align="left">$1.00</td> <td> <a href="#">UserID1</a> </td> <td>Single</td> </tr> <tr> <td align="left">$6.99</td> <td> <a href="#">UserID2</a> </td> <td>Multiple</td> </tr> <tr>... .....(snip) I tried the following iterator to iterate through all except the first row of the table that is a child of "div#statsID" and get the values of the 2nd and 3rd cells (in the example, the first extracted cells would have values of "UserID1" and "Single"), but it doesn't work. $('div#statsId > table tr:not(:nth-child(1))').each(function(i, ele) { var secondCol = $('td:nth-child(2)', ele).innerHTML var thirdCol= $('td:nth-child(3)', ele).text() ..... }); Any suggestions on how to specify and iterate through the rows (except the first) of a table that is a child of a div would be appreciated.

    Read the article

  • jQuery :contains selector to search for multiple strings

    - by Stefan
    Assuming i have: <li id="1">Mary</li> <li id="2">John, Mary, Dave</li> <li id="3">John, Dave, Mary</li> <li id="4">John</li> If i need to find all <li> Elements which contain "John" and "Mary", how would i construct the jQuery? A search for a single string seems easy: $('li:contains("John")').text() I am looking for something like the following pseudo code: $('li:contains("John")' && 'li:contains("Mary")').text() Thanks!

    Read the article

  • How to create a css rule for all elements except one class?!

    - by Nick
    Hi, I have created a CSS stylesheet for my project. Is there any way I can create a css rule that applies to all table elements EXCEPT table elements belonging to the class "dojoxGrid"? Something like: .not(dojoxGrid) table{ width:100%; border-top:1px solid #dddddd; border-left:1px solid #dddddd; border-right:1px solid #dddddd; margin:1em auto; border-collapse:collapse; } Thanks in advance!

    Read the article

  • $().mouseMove <-- Empty selector in jQuery 1.4

    - by Matrym
    The following bit of code breaks in the upgrade to jquery 1.4: $().mousemove( function (e) { defaults.mouseX = e.pageX; defaults.mouseY = e.pageY; }); }; What appeared to be a reasonable fix was adding "html" as the selector, ex: $("html"). The fix works fine - except now when the user mouses off the page, it doesn't register the mouse position beyond the boundaries. When attempting to use the mouse position for a drag, for example, the amount of movement beyond the screen is really important. Anyone got any ideas? Thanks in advance.

    Read the article

  • JQuery: Selector that contains some text, but doesn't contain others

    - by BPotocki
    Sorry if this question is mind numbingly easy to answer, but I'm a bit new to JQuery and I have a tight deadline. I am looking for a selector for textbox elements that have this format: id = "FixedName_#" "FixedName" will always be "FixedName", but I only want to find elements where the # is positive. So I would want to find "FixedName_1", and "FixedName_2" for example, but skip over "FixedName_-1" and "FixedName_-2". Thanks!

    Read the article

  • jquery select one class from many

    - by simnom
    Hi, I'm trying to achieve the following functionality. Within a form I have multiple fields with the class name .inputField if one of these fields is selected then the div associated with that element should be shown on focus and hidden on blur. However, when I implement the code below on selecting the second element the class is applied to both. Not sure where I'm going wrong?!?!? html markup: <form class="friendlyForm" name="friendlyForm" id="friendlyForm"> <ul> <li> <label for="testField">Test field</label> <input name="testField" value="here" class="inputField" id="testField" /> <div class="helper" style="display: none;">helper text here</div> </li> <li> <label for="testField">Test field2</label> <input name="testField2" value="here" class="inputField" id="testField2" /> <div class="helper" style="display: none;">helper text here</div> </li> </ul> </form> jQuery markup: $('.friendlyForm').find('.inputField').each(function(i) { $(this).blur(); $(this).focus(function() { //Add the focus class and fadeIn the helper div $(this).parent().addClass('focus'); $(this).parent().parent().find('.helper').fadeIn(); }); $(this).blur(function () { //Remove the focus class and fadeOut helper div $(this).parent().removeClass('focus'); $(this).parent().parent().find('.helper').fadeOut(); }); }); Any pointers here would be greatly appreciated. Thanks

    Read the article

  • How to get jQuery to find the first list-item, rather than all list-items?

    - by ricebowl
    I'm trying to implement a basic jQuery infinite carousel. As much for the learning process as for anything else (as a rule I'm not a fan of re-inventing wheels, but...I have to learn somehow, might as well start with the basics). I've managed to get the list to animate left happily enough, but I'm stuck when it comes to selecting the first element of the list. I've tried to use: $('ul#services > li:first'); $('ul#services > li:first-child'); $('ul#services > li').eq([0]); (xhtml below), In each case a console.log(first) (the var name used) returns all of the list-items. Am I doing something blatantly, and obviously, wrong? The eventual plan is to clone the first li, append it to the parent ul, remove the li from the list and allow the list to scroll infinitely. It's just a list of services rather than links so I'm not -at the moment- planning to have scroll or left/right functionality. Current xhtml: <div class="wrapper"> <ul id="services"> <!-- closing the `</li>` tags on the following line is to remove whitespace in the horizontal list, doesn't seem to make a difference to the jQuery from my own testing. --> <li>one</li ><li>two</li ><li>three</li ><li>four</li ><li>five</li ><li>six</li ><li>seven</li ><li>eight</li ><li>nine</li ><li>ten</li> </ul> </div>

    Read the article

  • Is there a selector or a work around to select any element with no children.

    - by rnaud
    Looking at the CSS3 specs, I can't find any way to select any element that has no children. Let me explain. <body> <h1>Main Page</h1> <div id="main"> <div class="post"> <h2>Article 1</h1> <p>some text</p> </div> <div class="post"> <h2>Article 2</h1> <p>some text</p> </div> </div> </body> I'm looking for a CSS syntax to select the h1, the two h2 and the two p. A way to select in any page, all elements with no children. Any suggestion ? Sorry, I forgot to add the "empty" part, I am actually already using the *:empty selector, but it's not working for any tag that has a nodeText as a child. So it's working for any input, image, object, but not for h2, h1, or any p.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >