Search Results

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

Page 18/31 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • reference a form inside a selector in jquery

    - by ooo
    if i have this code in jquery: var parentDiv = $(this).parent('.copyInstance'); inside this div there is a form. how do i reference a form element inside this selector? i want something like this $.post($(parentDiv + " Form").attr('action'), $(parentDiv + " Form").serialize(), function(data) { }); but this above doesn't seem to work

    Read the article

  • jquery .before() if class isn't present

    - by Afonso Gomes
    Using pagination, I have a div structure like so in the first page: <div class="ctema">...</div> <hr /> <div class="ctema">...</div> <hr /> <div class="ctema">...</div> <hr /> But with a jquery script to fetch content via AJAX... the following pages have only: <div class="ctema">...</div> <div class="ctema">...</div> <div class="ctema">...</div> I tried this: $('.ctematicas').before('<hr />'); But this doesn't checks if the HR tag is there or not and after 5 dynamic reloads In the first page I have 5 HR in a row ... How can I check if the HR tag is present between classes CTEMA and add one if not present?

    Read the article

  • JQuery: How to apply css to a .wrap element?

    - by Eamonn
    My code thus far: $(".lorem img:not(.full-img)").each(function() { $(this).addClass("inline-img"); var imgWidth = $(this).prop('width'); var imgHeight = $(this).prop('height'); var imgFloat = $(this).prop('float'); $(this).wrap('<div class="inline-img-wrap" />'); if ($(this).prop("title")!='') { $('<p class="inline-img-caption">').text($(this).prop('title')).insertAfter($(this)); } }); I am searching for images within a body of text, appending their title values as captions underneath, and wrapping both img and p in a div.inline-img-wrap. That works fine. What I need help with is applying the styling of the img to the new wrapping div instead. You can see I have created vars for just this, but cannot get applying them to work. $this will always apply to the image, and <div class="inline-img-wrap" style="width:'+imgWidth+'"> doesn't work. All advice appreciated!

    Read the article

  • jquery(selector) how to select the last element from two different classes

    - by Yasir Laghari
    for the following html <div> <div class="col1" > I dont want to select this </div> <div class="col2"> I dont want to select this </div> <div class="col1"> I dont want to select this </div> <div class="col1"> I dont want to select this </div> <div class="col2"> I WANT to select this </div> </div> How do I select the last element with two different class names? Tried using $("col1:last,col2:last) but it gives back 2 elements tried $("col1,col2:last") and this gives all col1 and last of col2

    Read the article

  • jquery .click function not getting triggered

    - by aakashbhowmick
    I have the following HTML and Javascript code. I am trying to make a search suggestion system. The list-items in the unordered-list 'search_suggest' are retrieved dynamically using ajax as the user types in the input box 'site_search' and inserted. <form name="search_site_form" method="get" action="search.php"> <input id="site_search" name="q" class="search_input input" autocomplete="off" value="Search the site" type="text"/> <ul id="search_suggest"> </ul> <input value=" " type="submit" class="search_submit"/> <script type="text/javascript"> <!-- $("ul#search_suggest>li").click(function(){ alert('123'); }); //--> </script> </form> Clicking on the list items in search_suggest however is not triggering the click function. Any idea why?

    Read the article

  • How to find out if a method exists in Obj-C when given an NSString

    - by Justin
    I have a method as an NSString *. If it exists, I want to call it, and if not, do nothing. SEL eventSelector = NSSelectorFromString(eventSelectorStr); if ([delegate respondsToSelector:eventSelector]) { [delegate performSelector:eventSelector]; [delegate adapterDidFinishAdRequest:self]; } else { // Does not implement selector } This code does not work, since NSSelectorFromString will register the string as a selector, so respondsToSelector:eventSelector will cause a crash because the selector is actually invalid.

    Read the article

  • Can first descendent be selected directly?

    - by Ben Huh
    I am currently using find() and first() method to select the first descendent element from each of the <div> elements that contains the parent class. But I find this quite cumbersome since find() method would produce a set of matched elements before the first element is being picked. The following is the skeleton of my code: HTML <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=non-parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> // .....the list continues Javascript $('.parent').each(function() { $(this).find('ul li').first().css('color', 'red'); // do other stuff within each loop }); I have seen people using $(".parent li:first") selector. But, because I am doing it in a loop, I am not sure how or whether if this could be done and would like some advice. Thanks.

    Read the article

  • how do you get a reference to an outer div using jquery

    - by oo
    if i have this html <div class="whole">This is a <div class="min">Test</div></div> i want to change the html of the "whole" div when i click on the "min" div: i have tried this below, but it doesn't seem to work. $(document).ready(function() { $('div.min').live('click', function() { $(this).prev('.whole').html("<img BORDER=0 src='../../images/copy1.png' />"); }); }); does anyone have any ideas on whats going wrong here ?

    Read the article

  • Speed up :visible:input selector avoiding filter

    - by macca1
    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:input:first but that doesn't seem to work.

    Read the article

  • Jquery persistent css selector equivalent to '.live()'

    - by Dan
    So today I just came across the 'live()' function that binds any future and past elements to the whatever event you choose, such as 'onclick'. Right now I'm having to set up buttons like the following each time I load a new button via ajax ... $('a.btn.plus').button({icons:{primary:'ui-icon-plusthick'}}); $('a.btn.pencil').button({icons:{primary:'ui-icon ui-icon-pencil'}}); $('a.btn.bigx').button({icons:{primary:'ui-icon ui-icon-closethick'}}); So, instead of calling these lines each time I use ajax to add a new button, is there a similar way to tell JQuery to setup my buttons ANYTIME I add new ones? Thanks for any help!

    Read the article

  • Why does the :nth-child(2) selector work on what I expect to be :first-child?

    - by Ben
    I have an example of what I'm trying to ask. I use this kind of format often. I'd expect to be able to select that first div with fieldset div:first-child { } but it seems that it's only grabbed by the 2nd child selector. I would expect "field 1" to be red and not blue. It makes more sense semantically (to me at least) to say "style the first div in the fieldset like so" instead of saying the 2nd. Why is this happening and is there a way to achieve the effect I want (to be able to call div:first-child)?

    Read the article

  • jquery selection with .not()

    - by Yako
    Hello, I have some troubles with jQuery. I have a set of Divs with .square classes. Only one of them is supposed to have an .active class. This .active class may be activated/de-activated onClick. Here is my code : jQuery().ready(function() { $(".square").not(".active").click(function() { //initialize $('.square').removeClass('active'); //activation $(this).addClass('active'); // some action here... }); $('.square.active').click(function() { $(this).removeClass('active'); }); }); My problem is that the first function si called, even if I click on an active .square, as if the selector was not working. In fact, this seems to be due to the addClass('active') line... Would you have an idea how to fix this ? Thanks

    Read the article

  • Select hidden input from within next td [jQuery]

    - by Fverswijver
    I have a table layed out like this: <td> somename </td> <td class="hoverable value" > somevalue </td> <td class="changed"> </td> <td class="original value"> <input type="hidden" value="somevalue" /> </td> And what I'm trying to do is, I hover over the hoverable td which turns it into a textbox. Once I hover out I want to check the hidden field for it's original value and put an image in changed if the 2 are different from each other. I already have this: $(document).ready( function() { var newHTML = ''; $('table td.hoverable').hover( function () { var oldHTML = $(this).html().trim(); $(this).html('<input type=\'text\' value=\'' + oldHTML + '\' size=\'' + ((oldHTML).length + 2) +'\' />'); }, function() { newHTML = $('input', this).val(); var oldHTML = $(this).next('td.original').children('hidden').val(); if(newHTML != oldHTML) { $(this).next('td.changed').html('Changed'); } $(this).html(newHTML); }) }); but it doesn't work. What fails apparently is grabbing the value of the hidden field, and I've tried selecting it in several different ways but just can't get to it. Any ideas or tips are gratefully appreciated ;)

    Read the article

  • Best way to find all input elements inside a form using jQuery

    - by Aayush
    I need to find all form elements inside inside a form and trigger a flag on change in the value. Currently I am using the method below. I am not sure if this works or not. But It surely works for: .find('input[type=text]) $('#form').find('input[type=text], input[type=radio], input[type=checkbox], select, textarea').each(function(){ $(this).change(function(){ if( change !== 1 ) change = 1; }); }) Now I have added multiple elements with the comma. Will this work and is this the best way to do this. Appreciate all the help. Thanks!

    Read the article

  • jQuery Drill down selector ?

    - by Etienne
    Hi, I have made this piece of code that makes a roll hover effect on any image you add the class 'simplehover' to it : //rollover effect on links $(".simplehover").mouseover(function () { $(this).attr("src", $(this).attr("src").replace("-off.", "-on.")); }).mouseout(function () { $(this).attr("src", $(this).attr("src").replace("-on.", "-off.")); }); <img src="slogan.gif" class="simplehover" /> Im trying to get it work if you add the class 'simplehover' to the surrounding element : . (especially usefull for ASP.net asp:HyperLink tag which automatically generate the IMG tag inside the hyperlink. <a href="#" class="simplehover"> <img src="slogan.gif" /> </a> If I change my selector for : $(".simplehover img") , it will work, however it no longer works in senario #1. I tried this with no luck: $(".simplehover").mouseover(function () { if ($(this).has('img')) { $(this) = $(this).children(); } ... Anyone can figure this out?

    Read the article

  • Nested <a> and <span> challenge

    - by PaddyO
    Hi all, Trying in vain to get a nested link working within a nested span. This is a working test page for the code below to explain what I'm trying to do. Any ideas on how to get this working in valid html? I guess it's either a nesting order or style syntax thing but I am at a loss. Any thoughts much appreciated. <div id="greyback"> <ul id="scrollbox"> <li class="listcat">List header</li> <li><a class="menu" href="#freeze">List item 1<span><b>This text has popped up because you have clicked the list item, which has an "a" tag and now has :focus. That "a" tag is the first of two.</b><br><br>What I am trying to do is to set the second "a" tag as a DIFFERENT "embedded" link in this box<span style="color: blue; background-color: yellow;">eg, here<a href="http://www.conservationenterprises.com" target="blank">This is the second (nested) "a" tag in this html nest. It is a link to an external site. Instead of this being an always-visible link, I want it to sit within the yellow box in the first span (click the List item 1 to display).</a></span> </a></span> </li> </a></span> </li> </ul> </div> and the CSS: #scrollbox {margin: 0 auto; margin-top: 1em; margin-bottom: 1em; width:19em; height:auto; max-height: 21em; overflow:auto; border-bottom: 0.1em solid #FFA500; border-top: 0.1em solid #FFA500;} #scrollbox a {float: left; color:#000000; text-decoration:none; width:18em; height: auto; margin-bottom: 0.5em; font-family: Arial, sans-serif; font-size: 0.9em; text-align:left;} #scrollbox a.menu {} #scrollbox a span {display:none; position:absolute; left:0em; top:0;} #scrollbox a span img {float: right; border:0; max-width:7.5em;} #scrollbox a:hover {border: 0; color: #7ebb11; font-size:0.9em;} #scrollbox a:hover span {border: 0; color: #535353;} #scrollbox a span:focus {color: blue;} #scrollbox a:active {border:none; color: #535353; text-decoration: none;} #scrollbox a:focus {border:0em solid #000; outline:0;} #scrollbox a:active span, #scrollbox li a:active span, #scrollbox a:focus span, #scrollbox li a:focus span {display: block; width: 52.5em; min-height: 20em; height: auto; left: 1.5em; top:18em; z-index:10; font-size:0.9em; text-align: left; padding: 1em; padding-bottom: 0em; background-color: #c3FFe3; color: #535353; border: solid #FFA500 0.25em;} #scrollbox li a:active span span, #scrollbox li a:focus span span{display: block; width: auto; height: auto; min-height: 2em; left: 25em; top:10em; z-index:10; font-size:0.9em; text-align: left; padding: 1em; padding-bottom: 0em; background-color: transparent; color: #535353; border: dashed red 1px;} .ul#scrollbox {padding-left: 0.1em;} #scrollbox li {float:left; list-style: none; background: url(blank.png) no-repeat left center; margin-left: 0em; font-family:Arial, sans-serif; font-size: 0.9em;} #scrollbox li.listcat {float: left; text-align:left; width: 18em; margin-left: 0em; margin-top: 0.1em; margin-bottom: 0.3em; padding-top:0.5em; color: green; font-size: 0.9em; font-weight:bold;} Cheers Patrick.

    Read the article

  • Jquery .text() call returns null?

    - by Alex
    Hey all, I'm practicing Jquery and I've written this simple Jquery statement: var someText = $("table tr td").text(); Should this not return all text of td elements found within tr's that are found within tables? How do I fix this? Currently when I run this, it says that table tr td is null, but I have a table on the page I'm testing on. Thanks!

    Read the article

  • Need to override cascade style

    - by WillingLearner
    i have a style : .window .div { border:medium solid #000000; height:150px; background-color: #0099FF; } and then i have another style: #NewDiv { font:Arial, Helvetica, sans-serif; font-size: 24px; height: 20px; border-bottom-width: medium; border-bottom-style: solid; border-bottom-color: #000000; } I need to put a #NewDiv div tag inside of window .div, BUT... #NewDiv must retain its own styling while sitting inside of window .div div tags. How do I do this? Currently when I try, #NewDiv takes on the same styling as window .div when i place it inside of it and i dont want that at all. Any suggestions?

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >