Search Results

Search found 3639 results on 146 pages for 'dom manipulation'.

Page 23/146 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • jQuery Datatables and ColumnFilterWidget integration issue

    - by user3520135
    I am trying to Place the ColumnFilterWidget plugin in the Header of the Datatables Table. Here are the changes i made in it : /** * Menu-based filter widgets based on distinct column values for a table. * * @class ColumnFilterWidgets * @constructor * @param {object} oDataTableSettings Settings for the target table. */ var ColumnFilterWidgets = function( oDataTableSettings ) { var me = this; var sExcludeList = ''; // me.$WidgetContainer = $( '<div class="column-filter-widgets"></div>' ); me.$WidgetContainer = $( '<tr class="head"></tr>' ); me.$MenuContainer = me.$WidgetContainer; me.$TermContainer = null; me.aoWidgets = []; me.sSeparator = ''; if ( 'oColumnFilterWidgets' in oDataTableSettings.oInit ) { if ( 'aiExclude' in oDataTableSettings.oInit.oColumnFilterWidgets ) { sExcludeList = '|' + oDataTableSettings.oInit.oColumnFilterWidgets.aiExclude.join( '|' ) + '|'; } if ( 'bGroupTerms' in oDataTableSettings.oInit.oColumnFilterWidgets && oDataTableSettings.oInit.oColumnFilterWidgets.bGroupTerms ) { me.$MenuContainer = $( '<div class="column-filter-widget-menus"></div>' ); me.$TermContainer = $( '<div class="column-filter-widget-selected-terms"></div>' ).hide(); } } // Add a widget for each visible and filtered column $.each( oDataTableSettings.aoColumns, function ( i, oColumn ) { var $columnTh = $( oColumn.nTh ); var $WidgetElem = $( '<th><div class="column-filter-widget"></div></th>' ); if ( oColumn.bVisible && sExcludeList.indexOf( '|' + i + '|' ) < 0 ) { me.aoWidgets.push( new ColumnFilterWidget( $WidgetElem, oDataTableSettings, i, me ) ); } me.$MenuContainer.append( $WidgetElem ); } ); if ( me.$TermContainer ) { me.$WidgetContainer.append( me.$MenuContainer ); me.$WidgetContainer.append( me.$TermContainer ); } oDataTableSettings.aoDrawCallback.push( { name: 'ColumnFilterWidgets', fn: function() { $.each( me.aoWidgets, function( i, oWidget ) { oWidget.fnDraw(); } ); } } ); return me; }; I added a extra <tr class='head'> inside the Datatable, and later on i am trying to append the Filters to that with attached to them,But instead of that it is creating new TR tag and then appending the filters in it. I even changed my dom of data tables to : dom: '<"clear">Cf<"clear">ltWrip', So the table elements should be there so that it can insert filters inside the head.

    Read the article

  • Javascript newbie, how to choose between window.URL.createObjectURL() and window.webkitURL.createObjectURL() based on browser

    - by Rohith Raveendran
    From the firefox developer website I know that firefox use objectURL = window.URL.createObjectURL(file); to get url of file type, but in chrome and other webkit browsers we have window.webkitURL.createObjectURL() for detecting url. I don't know how to swap this functions based on browser engines, and I need it to be worked on both browsers (Chrome and firefox) https://developer.mozilla.org/en/DOM/window.URL.createObjectURL

    Read the article

  • What damage is done by document.write()?

    - by Simon Gibbs
    What bad things happen at the moment document.write() is invoked? I've heard bits and peices about document.write having an adverse impact on the DOM or on the use of Javascript libraries. I have an issue in front of me that I suspect is related, but have not been able to find a concise summary of what damage the method does.

    Read the article

  • jQuery, checking to see if video has height/width

    - by Mark
    I have a <video> element that is generated by js, and I need to get the height and width of it. var v = $('video'); v.height() returns null, because when it's run, the video hasn't yet been loaded, so no dimensions in the DOM. How do I check to see if the video has received a dimension, and if it hasn't, wait till it has to get the height and width. Thanks.

    Read the article

  • How to scrap the first paragraphe from a wikipedia page?

    - by David
    Hi, Let's say i want to grab the first paragraphe in This wikipedia Page How to get the principal text between the title and CONTENTS box using XPath or DOM & PHP or something similar? Is there any php library for that? i don't want to use the api because it's a bit complex. Note: i just need that to add a widget under my pages that displays related infos from wikipedia. Thanks

    Read the article

  • How to scrape the first paragraph from a wikipedia page?

    - by David
    Let's say I want to grab the first paragraph in this wikipedia page. How do I get the principal text between the title and contents box using XPath or DOM & PHP or something similar? Is there any php library for that? I don't want to use the api because it's a bit complex. Note: i just need that to add a widget under my pages that displays related info from Wikipedia.

    Read the article

  • Are event handlerss in JavaScript called in order?

    - by musicfreak
    I know this is a simple question, but I haven't had the chance to test it in any browser other than Firefox. If I attach multiple event handlers to a single event on a single DOM element, are the event handlers guaranteed to be called in the order they were added? Or should I not rely on this behavior?

    Read the article

  • Javascript: how to tell if a node object has been inserted into a document yet

    - by thomasrutter
    I'd like to be able to identify whether a given DOM node has been inserted into a document, or part of one, yet, or whether it is fresh out of document.createElement() or similar and has not been placed anywhere. In most browsers just checking the parentNode works. if (!node.parentNode) { // this node is not part of a larger document } However, in Internet Explorer it appears that new elements, even right after they've been created with document.createElement() already have a parentNode object (of type DispHTMLDocument??). Any other nice cross-browser and reliable way?

    Read the article

  • How to get calculated element width and height in YUI3?

    - by Jaanus
    jQuery has handy .height() and .width() utilities to get calculated displayed size of a DOM element. It also has .position() to get coordinates. In YUI3 Node, I see that there are .getX(), .getY() and .getXY() utilities to get position, but I do not see anything for size (or can't look). What's a good way to get element height and width in YUI3?

    Read the article

  • Is document.links faster in finding a link using jQuery?

    - by vsync
    Is this faster: $(document.links).filter('a.someClass') than just plain old this: $('a.someClass') ? I don't see anywhere in jQuery's code the utilization of document.links which gives you the collection of links on the document right away, than, it would seem, it would be faster to just filter in the collection instead of all the DOM nodes, which is alot more nodes to go over.

    Read the article

  • Are event handlers in JavaScript called in order?

    - by musicfreak
    I know this is a simple question, but I haven't had the chance to test it in any browser other than Firefox. If I attach multiple event handlers to a single event on a single DOM element, are the event handlers guaranteed to be called in the order they were added? Or should I not rely on this behavior?

    Read the article

  • Elements added with appendTo() not immediately available

    - by Zip Gun Jim
    I'm having a problem with elements added with appendTo() not being immediately available in the DOM. First, I'm reading some data from a JSON file and then appending some html to a div. jsonUrl = "js/performers.json"; $.getJSON(jsonUrl, function(json) { $.each(json.performers, function(i, performer) { var html = '<div class="performer_mini">'; html += '<img src="' + performer.thumbnail + '" alt="' + performer.name + '" /><br />'; html += performer.name + '<br /></div>'; $(html).appendTo("div#performer_spotlight"); }); }); Then I'm calling a random shuffler plugin to show one of the added divs at a time. $("#performer_spotlight").randomShuffler(".performer_mini", 3000, 3000, 9000); The random shuffler does the following: (function($) { $.fn.randomShuffler = function(shuffledElements, fadeInTime, fadeOutTime, timeout) { fadeInTime = fadeInTime || 3000; fadeOutTime = fadeOutTime || 3000; timeout = timeout || 9000; $(shuffledElements).hide(); var $old_element; var $new_element; var old_index = 0; var new_index = 0; function shuffleElement() { $old_element = $new_element; old_index = new_index; while ($(shuffledElements).length > 0 && old_index == new_index) { // don't display the same element twice in a row new_index = Math.floor(Math.random()*$(shuffledElements).length); } $new_element = $(shuffledElements + ":eq(" + new_index + ")"); if ($old_element != undefined) { $old_element.fadeOut(fadeOutTime, function() { $new_element.fadeIn(fadeInTime); }); } else { $new_element.fadeIn(fadeInTime); } setTimeout(shuffleElement, timeout); } $(this).show(); shuffleElement(); } })(jQuery); The first time the shuffleElement() function is called $(shuffledElements).length equals 0, so no element is displayed. On the next call to shuffleElement(), the elements added with appendTo() are available and one is selected at random as expected. Everything works correctly after that. Is there some way to refresh the DOM or make these elements available to jQuery immediately after I add them with appendTo()? Any other suggestions for how to accomplish this?

    Read the article

  • jQuery find events handlers registered with an object

    - by ages04
    I need to find which event handlers an object has registered. eg. $("#el").click(function(){...}); $("#el").mouseover(function(){...}); Is there anyway I can use a function to find out that- $("#el") has click and mouseover registered and possibly iterate over the event handlers. If not a jQuery Object can we find this on a plain DOM object?

    Read the article

  • Jquery bind doesnt work on AJAX loaded HTML

    - by atif089
    Hi, This is my jquery code jQuery(document).ready (function() { // post $('.post').bind('mouseenter mouseleave', function() { $(this).filter('.btn').toggleClass('hidden'); }); }); It works great on a normal document. but When I load some HTM: (i.e some divs with .post attributes) using ajax and embed it into my DOM. The above code doesnt work with those divs.

    Read the article

  • Using jQuery to gather all text nodes from a wrapped set, separated by spaces

    - by Bungle
    I'm looking for a way to gather all of the text in a jQuery wrapped set, but I need to create spaces between sibling nodes that have no text nodes between them. For example, consider this HTML: <div> <ul> <li>List item #1.</li><li>List item #2.</li><li>List item #3.</li> </ul> </div> If I simply use jQuery's text() method to gather the text content of the <div>, like such: var $div = $('div'), text = $div.text().trim(); alert(text); that produces the following text: List item #1.List item #2.List item #3. because there is no whitespace between each <li> element. What I'm actually looking for is this (note the single space between each sentence): List item #1. List item #3. List item #3. This suggest to me that I need to traverse the DOM nodes in the wrapped set, appending the text for each to a string, followed by a space. I tried the following code: var $div = $('div'), text = ''; $div.find('*').each(function() { text += $(this).text().trim() + ' '; }); alert(text); but this produced the following text: This is list item #1.This is list item #2.This is list item #3. This is list item #1. This is list item #2. This is list item #3. I assume this is because I'm iterating through every descendant of <div> and appending the text, so I'm getting the text nodes within both <ul> and each of its <li> children, leading to duplicated text. I think I could probably find/write a plain JavaScript function to recursively walk the DOM of the wrapped set, gathering and appending text nodes - but is there a simpler way to do this using jQuery? Cross-browser consistency is very important. Thanks for any help!

    Read the article

  • How to get all <img> tags inside a text selection?

    - by CyberShadow
    I've looked around for a while, but there doesn't seem to be a simple way to do this. jQuery doesn't help the in least, it seems to entirely lack any support for selection or DOM ranges. Something which I hoped would be as simple as $.selection.filter('img') seems to only be doable with dozens of lines of code dealing with manually enumerating elements in ranges and browser implementation inconsistencies (though ierange helps here). Any other shortcuts?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >