Search Results

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

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

  • jQuery inconsistent .remove by class on element with multiple classes

    - by pedalpete
    I've got a page where messages and associated elements (responses, forwards, etc) all share a class based on the database id of the parent. For example this is a message this is another message this is a comment this is another comment tim posted a new message sara forwarded a message to john at times I need to remove all elements with the same id, so I originally had jQuery('div#'+id).remove(); but that would sometimes not remove all the ids because ids are supposed to be unique. So I added the id as a class. now I use jQuery('div.'+id).remove(); but this seems to be about 80% effective, and sometimes the divs aren't being removed. I'm not sure if the issue is because the div has more than one class, but I need the classes because that is how I refer to the elements when somebody clicks. For instance, jQuery('div.message').click(function(){ get the id, send it to the server and get the message }); is there something wrong I'm doing here? or is there a better way to do this?

    Read the article

  • Select subsets of elements, and wrap them in a div

    - by scullytr
    Hello, I have a set of selected elements in jQuery: <div id="element1" class="element"></div> <div id="element2" class="element"></div> <div id="element3" class="element"></div> <div id="element4" class="element"></div> <div id="element5" class="element"></div> <div id="element6" class="element"></div> <div id="element7" class="element"></div> <div id="element8" class="element"></div> <div id="element9" class="element"></div> <div id="element10" class="element"></div> <div id="element11" class="element"></div> <div id="element12" class="element"></div> I would like to wrap these elements into groups of five like so: <div class="wrapper"> <div id="element1" class="element"></div> <div id="element2" class="element"></div> <div id="element3" class="element"></div> <div id="element4" class="element"></div> <div id="element5" class="element"></div> </div> <div class="wrapper"> <div id="element6" class="element"></div> <div id="element7" class="element"></div> <div id="element8" class="element"></div> <div id="element9" class="element"></div> <div id="element10" class="element"></div> </div> <div class="wrapper"> <div id="element11" class="element"></div> <div id="element12" class="element"></div> </div> Is there an efficient/easy way to do this? I imagine it would look something like this: $('.element').wrapAll('<div class="wrapper"></div>'); But with a selector that selects the elements in groups of five. Thanks!

    Read the article

  • jquery child selector problems

    - by codedude
    I have a basic website nav layout that looks like this: <li class="folder parent_folder"> <a href="#">Some Folder</a> <ul class="submenu"> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> </ul> I have several of these throughout the site's page. Using jquery, I'm trying to make it so that when you click "li.parent_folder" "ul.submenu" disappears and then reappears when you click "li.parent_folder" again. I can get it to do this but I have a problem. When I click on the "li.parent_folder" all the "ul.submenu" disapear instead of just the one that is the child of it. What would be the correct jquery code to accomplish this? (Oh, I'm using jquery ui also in this project What I have right now is this: $('li.parent_folder').click(function() { $('li.parent_folder ul.submenu').hide(); });

    Read the article

  • Can I use the CSS :visited pseudo class on 'wildcard' links?

    - by rabidpebble
    Let's say I have a site with multiple links as follows: www.example.com/product/1 www.example.com/product/2 www.example.com/product/3 I also append tracking info to links from time to time so that I can see how my site is being used, e.g, if somebody visits the products page from the product browser I would set a ref parameter: www.example.com/product/1&ref=pb www.example.com/product/2&ref=pb www.example.com/product/3&ref=pb The problem with this is that if the user visits a link of the first type and then views a link of the second type then the :visited pseudo class doesn't seem to apply because the browser only seems to match on exact URLs. Is there any way to have "wildcards" apply to links in this sense, so that when the user sees either the first type or the second type of link that it is highlighted? Note: I cannot change this "ref" architecture; it is inherited.

    Read the article

  • set equal height on multiple divs

    - by Greenie
    I need to set equal height on a series of divs inside another div wrapper. The problem is that I dont want the same height on all of them. The page kind of have 3 columns and the floating divs can be 1, 2 or 3 columns wide. The divs float left, so the following example will give me three rows of divs in my wrapper. How can I set equal height on the divs that are in the same row? In my example I want nr 1 and 2 to have equal height and 3, 4 and 5 another equal height? I cant know beforehand how many divs there is or how wide or high they are. Edit: They can be for instance 300, 600 or 900 px wide and the page width is 900px <div id="wrapper"> <div class="one-wide">nr1</div> <div class="two-wide">nr2</div> <div class="one-wide">nr3</div> <div class="one-wide">nr4</div> <div class="one-wide">nr5</div> <div class="three-wide">nr6</div> </div> Im thinking I somehow need to figure out when the added width of the divs is at the full page width and set equal height on those. Then do the same on the next divs. But I cant wrap my head around it. Currently im just using this to set the height on the children of the wrapper: $.fn.equalHeights = function(px) { $(this).each(function(){ var currentTallest = 0; $(this).children().each(function(i){ if ($(this).height() > currentTallest) { currentTallest = $(this).height(); } }); // for ie6, set height since min-height isn't supported if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); } $(this).children('div').css({'min-height': currentTallest}); }); return this; };

    Read the article

  • How do you change the style of cell in a JQuery.DataTable?

    - by Sephrial
    Hello fellow coders, I have a question about setting the style attributes for a data cell in the jQuery.DataTable. I was able to set the width for each column when initializing the dataTable using the following: oTable = $('#example').dataTable( { "aoColumns" : [ { sWidth: '40%' }, { sWidth: '60%' } ] } ); However, now I want to change the alignment for the second column like so: style="text-align: right;". I am adding rows dynamically: /* Global var for counter */ var giCount = 2; function fnClickAddRow() { oTable.fnAddData( [ 'col_1', 'col_2' ] ); giCount++; } Can you tell me how I can select the second cell of the added row after it's inserted? OR can you tell me how to set the style of the row before/during insertion? Any help would be greatly appreciated!

    Read the article

  • is there any way to group css styles based on their ids?

    - by Brian
    If I have a chunk of css styles that are applied within a certain page element, I would like to group them rather than identify the containing page element for each style. For example, I would like to turn: #bodywrap #leftcolumn p {...} #bodywrap #leftcolumn div {...} #bodywrap #leftcolumn .highlight {...} into something like: #bodywrap #leftcolumn [ p {...} div {...} .highlight {...} ] where everything contained in the brackets respects the containing declarations. Is this possible with css, and what would be the syntax?

    Read the article

  • Toggle a CSS selector using JQuery

    - by BEECHBOY707
    I am trying to toggle the display of a CSS selector (ie.to show/hide it) using JQuery. I successfully toggled the display of a div, but want to do this now with the CSS selector :after. The CSS selector is being used to create the arrow on the box. My attempt can be seen here: http://jsfiddle.net/beechboy707/7um9knxt/1/ Here is an extract from it showing the Jquery which is supposed to relate to the CSS selector: $("#supportus-button-1").click(function () { $(".supportus-button:after").toggle(); }); Many thanks for your help, Max

    Read the article

  • Get the selected option id with jQuery

    - by Itamar Bar-Lev
    Hi, I'm trying to use jQuery to make an ajax request based on a selected option. Is there a simple way to retrieve the selected option id (e.g. "id2") using jQuery? <select id="my_select"> <option value="o1" id="id1">Option1</option> <option value="o2" id="id2">Option2</option> </select> $("#my_select").change(function() { //do something with the id of the selected option });

    Read the article

  • using the data-custom="" to bind to events

    - by Dean Peterson
    I'm pretty sure I'm gonna get slammed on this. I love using the data-whatever attribute to bind events to. It feels very clean to me and helps reserve my class attribute for just styling. I know this selector is among the slowest, so I don't use it when there are a lot of elements. Would love to hear compelling arguments against this. $("body").delegate("[data-action]", "click", function(){ var action = $(this).attr("data-action"); //route action to appropriate function });

    Read the article

  • Getting elements children with certain tag jQuery

    - by johnnyArt
    I'm trying to get all the input elements from a certain form from jQuery by providing only the name of the form and only knowing that those wanted fields are input elements. Let's say: <form action='#' id='formId'> <input id='name' /> <input id='surname'/> </form> How do I access them individually with jQuery? I tried something like $('#formId > input') with no success, in fact an error came back on the console "XML filter is applied to non-XML value (function (a, b) {return new (c.fn.init)(a, b);})" Maybe I have to do it with .children or something like that? I'm pretty new at jQuery and I'm not really liking the Docs. It was much friendlier in Mootools, or maybe I just need to get used to it. Oh and last but not least, I've seen it asked before but no final answer, can I create a new dom element with jQuery and work with it before inserting it (if I ever do) into de code? In mootools, we had something like var myEl = new Element(element[, properties]); and you could then refer to it in further expressions, but I fail to understand how to do that on jQuery Thanks in advance.

    Read the article

  • edge case for selecting a checked radio input with jquery

    - by altvali
    Hi all! I have a problem selecting a checked radio button with jquery. The radio buttons are generated by a function from a MVC that i'd rather not change and its name is like id[number]. Simply put, I have to check if any of these buttons are checked: <input type="radio" name="id[1]" value="1"/ <input type="radio" name="id[1]" value="2"/ The problem is that jQuery('input:radio[name=id[1]]:checked').val() will select some function from the jQuery library. Any help will be much appreciated.

    Read the article

  • not able to get a processed list in jquery variable

    - by Pradyut Bhattacharya
    I have html list <ol id="newlist"> <li>Test <ol> <li>1</li> <li>2</li> <li>3</li> </ol> </li> <li>Another test <ol> <li>1</li> </ol> </li> <li>Cool Test <ol> <li>1</li> <li>2</li> </ol> </li> </ol> Now i have hidden the list using the css... #newlist li { display:none; list-style: none; } I want to display the list and the only the descendants which have greater than 1 descendants... the output should be... Test 1 2 3 Another test Cool Test 1 2 I have used jquery and able to get the output... the code i used... $("ol#newlist > li").show(); for (var i = 0; i < $("ol#newlist > li").length; i++) { if ($("ol#newlist > li:eq(" + i + ") ol > li").length > 1) $("ol#newlist > li:eq(" + i + ") ol > li").show(); } the sample page here Now i want all the list in a single variable like i can get the lis in a variable... var $li = $("ol#newlist > li"); but the code $li.add($("ol#newlist > li:eq(" + i + ") ol > li")); is not working... the sample page here Please help... Thanks Pradyut India

    Read the article

  • Faster jquery selector for finding a number of TD elements

    - by Bernard Chen
    I have a table where each row has 13 TD elements. I want to show and hide the first 10 of them when I toggle a link. These 10 TD elements all have an IDs with the prefix "foo" and a two digit number for its position (e.g., "foo01"). What's the fastest way to select them across the entire table? $("td:nth-child(-n+10)") or $("td[id^=foo]") or is it worth concatenating all of the ids? $("#foo01, #foo02, #foo03, #foo04, #foo05, #foo06, #foo07, #foo08, #foo09, #foo10") Is there another approach I should be considering as well?

    Read the article

  • Which CSS editor can give formatting like this in one shot automatically?

    - by jitendra
    Which free (offline) CSS tool can give formatting like this in one shot automatically? using any keyboard shortcut of from any command of IDE example This (it can be any type of formatting) #proceed_form ol, #demo_form ol { list-style:none; margin:0; padding:0} #proceed_form ol li, #demo_form ol li { padding:2px 0; margin:0; line-height:normal; height:18px} #proceed_form ol li label, #demo_form ol li label { display:inline-block; width:195px;} into like this #proceed_form ol, #demo_form ol { list-style: none; margin: 0; padding: 0 } #proceed_form ol li, #demo_form ol li { padding: 2px 0; margin: 0; line-height: normal; height: 18px } #proceed_form ol li label, #demo_form ol li label { display: inline-block; width: 195px; } Can we achieve this type of formatting in Dreamweaver? or it not possible in dreamweaver then in any other tool?

    Read the article

  • Optimizing jQuery for Tabs

    - by jpdbaugh
    I am in the process of developing a widget. The widget has three tabs that are implemented in the following way. <div id="widget"> <ul id="tabs"> <li><a href="http...">One</a></li> <li><a href="http...">Two</a></li> <li><a href="http...">Three</a></li> </ul> <div id="tab_container"> <div id="tab_content"> //Tab Content goes here... </div> </div> </div> // The active class is initialized when the document loads $("#tabs li a").click(function() { $("#tabs li.active").removeClass("active"); $("#tab_content").load($(this).attr('href')); $(this).parent().addClass("active"); return false; }); The problem I am having is that the jquery code that have written is very slow. If the user changes tabs quickly the widget gets behing and bogged down. This causes the tabs to to not align with the data being displayed and just general lag. I believe that this is because the tab is being changed before $.load() is finished. I have tried to implement the following: ("#tabs li a").click(function() { $("#tabs li.active").removeClass("active"); $("#tab_content").load($(this).attr('href'), function (){ $(this).parent().addClass("active"); }); return false; }); It is my understanding that the callback function within in the load function does not execute until the load function is completed. I think this would solve my problem, however I can not come up with a way to select the correct tab that was clicked within the callback function. If this is not the way to do this then what is the best way implement these tabs so that they would stop loading an old request and load the newest tab selection by the user? Thanks

    Read the article

  • validate dynamically added textbox

    - by Hulk
    In the below code how to validate for null values for only the dynamically added text box i.e,r_score1,r_score2......... <script> function validate() { //How to validate the r_Score.. textfields } $(document).ready(function() { for(var i=0;i< sen.length;i++) { row += '<input type="text" name="r_score'+i+'" id="r_score'+r_count+'" size="8" />'; } $('#details').append(row); }); </script> <div id="details"><input type="text" name="score' id="score" size="8" /></div> <input type="button" value="Save" id="print" onclick="javascript:validate();" />

    Read the article

  • jQuery returning two elements for each one it finds?

    - by John Rudy
    I'll start by saying I'm fairly new to jQuery. For the most part, I've found it intuitive and powerful, but this one circumstance has me thoroughly stumped. In the following method, the call to .each() returns two elements for every one found. It iterates over a set of table rows given IDs starting with the word, "communication," and followed by an ID number. For each row it returns, it processes twice. Using Firebug, I've validated that the DOM only has a single instance of each table row in question. Also using Firebug, I've validated that the method is not being called twice; the iteration in .each() is truly going over each returned table row twice. By the time all the AJAX call goodness is done, I'll have two entries in the database for each row created in the table. This is the code that's causing the issues: function getCommunications() { var list = $('[id^=communication]'); var communications = new Array(); list.each(function () { var communication = { ID: $(this).find('.commCompanyID').val(), /* * SNIP: more object properties here that are * unnecessary to this discussion */ }; communications.push(communication); }); return communications; } At the point of return communications, the Array returned will contain twice as many elements as there are table rows. I should note that nearly identical code (but going against specific lists of divs) is working on the same page. It's just the table that's suffering the issues. I'm using jQuery 1.4.1, the version which shipped with Visual Studio .NET 2010. The table markup is fully dynamic -- that is, aside from the header row, it's dependent on data either returned at page load or created by the user via a dialog box. I'll drop in just the code for what's created at page load; again using Firebug I've validated that what I create dynamically when an end user creates a row with the dialog box matches. (This should be readable by anyone, but for the record this is an ASP.NET MVC 2.0 project.) <table id="commTable"> <tr> <th></th> <th> Date / Time </th> <th> Contact </th> <th> Type </th> <th> Duration </th> <th> Notes </th> </tr> <% foreach (var item in Model) { %> <tr id="communication<%: item.ID %>"> <td> <a href="#" onclick="showEditCommunicationForm(<%: item.ID %>"> Edit</a> <span class="commDeleteButton"> <a href="#" onclick="deleteCommunication(<%: item.ID %>)"> Delete</a> </span> </td> <td> <span class="commDateTime"><%: item.DateTime %></span> <input type="hidden" class="commID" value="<%: item.ID %>" /> <input type="hidden" class="commIsDeleted" value="<%: item.IsDeleted %>" /> </td> <td> <span class="commSourceText"><%: item.Company.CompanyName %></span> <input type="hidden" class="commCompanyID" value="<%: item.CompanyID %>" /> </td> <td> <%: item.CommunicationType.CommunicationTypeText %> <input type="hidden" class="commTypeID" value="<%: item.CommunicationTypeID %>" /> </td> <td> <span class="commDuration"><%: item.DurationMinutes %></span> Minutes </td> <td> <span class="commNotes"><%: item.Notes %></span> </td> </tr> <% } %> </table>

    Read the article

  • selecting href not starting with http

    - by sushil bharwani
    using jQuery i am trying to find out all the URLS that user has entered which are not starting with http or https and finally i want to prepend http to all such URLs so that when user clicks on them they are taken to a proper site instead of broken link caused due to entry of URLs without http or https. Also like to mention that User have a field "Websites they Like" where they enter websites of their interest. So if they like stackoverflow, they may end up writing www.stackoverflow.com which will be considered a relative link without http. Also my requirments are such that i cant prompt user to enter http or https before there urls

    Read the article

  • Using css child selector

    - by David Thorisson
    I am trying to apply css on the first A element inside .Outer, .Outer > a:first-child {font-weight:bold} doesn't work. Why? <div class="Outer"> <img src='image123.jpg' /> <a href="Default.aspx?ID=4083" id="ctl00_CPH_Main_Rep_List2_ctl03_HyperLink1">John Johnsson</a> <a href="../Users/ViewList.aspx?module=Occupation&amp;ID=70">Doctor</a> <a href="../Workplaces/Default.aspx?ID=31">Mayo Clinica> </div>

    Read the article

  • Which CSS editor can give nested formatting like this in one shot automatically?

    - by jitendra
    Which free (offline) CSS tool can give formatting like this in one shot automatically? using any keyboard shortcut of from any command of IDE example This (it can be any type of formatting) #proceed_form ol, #demo_form ol { list-style:none; margin:0; padding:0} #proceed_form ol li, #demo_form ol li { padding:2px 0; margin:0; line-height:normal; height:18px} #proceed_form ol li label, #demo_form ol li label { display:inline-block; width:195px;} into like this #proceed_form ol, #demo_form ol { list-style: none; margin: 0; padding: 0 } #proceed_form ol li, #demo_form ol li { padding: 2px 0; margin: 0; line-height: normal; height: 18px } #proceed_form ol li label, #demo_form ol li label { display: inline-block; width: 195px; } Can we achieve this type of formatting in Dreamweaver? or it not possible in dreamweaver then in any other tool?

    Read the article

  • How to select an element by Class instead of ID in ASP.NET?

    - by firedrawndagger
    I have a few scatter elements which I am grouping together using a class like so - . In my code behind, using C# I want to hide these elements, using something like instructions.Visible = false;. However I realize I can only do this in codebehind if I use ID but this will result in invalid HTML/CSS Selector since you can't have multiple ID's with the same ID name... Alternatively is there another way to group the controls if not by class?

    Read the article

  • Find if id of a link equals id of parent container

    - by Robert Lawson
    Hi guys needing a bit of help. I am creating a one page personal site. Each section has a menu in it to jump to another section, however i want to have a class added to menu for the current section: i.e. if you are in about the about link would have a class 'current'. This is how it looks. <section id="about"> <nav> <li><a href="#" id ="about">About</a></li> <li><a href="#" id ="contact">About</a></li> <li><a href="#" id ="blog">About</a></li> </nav> New to jquery so i am struggling to find out how to do this. Any help will be greatly appreciated. Thanks

    Read the article

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