Search Results

Search found 645 results on 26 pages for 'classname'.

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

  • Code don't work, can't read property 'className' of undefined

    - by Arlen Beiler
    What is wrong with this code? var divarray = []; var articleHTML = []; var absHTML; var keyHTML; var bodyHTML = []; var i = 0; divarray = document.getElementById("yui-main").getElementsByTagName("div"); for ( var j in divarray) { if(divarray[i].className == "articleBody"){ alert("found"); articleHTML = divarray[i]; break; } bodyHTML[i] = ''; if(articleHTML[i].className == "issueMiniFeature"){continue;} if(articleHTML[i].className == "abstract"){absHTML = articleHTML[i]; continue;} if(articleHTML[i].className == "journalKeywords"){keyHTML = articleHTML[i]; continue;} bodyHTML[i] = articleHTML[i]; i++; } The error I get is: TypeError: Cannot read property 'className' of undefined I am using Google Chrome.

    Read the article

  • fullCalendar className to multiple eventSources

    - by Justin
    I am trying to setup my fullCalendar event sources. instead of pulling all of my events through 1 source, I would like to use multiple sources (ie: google, and local json) Here is what I have so far (In short): eventSources: [ //CA HOLIDAYS $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.canadian%23holiday%40group.v.calendar.google.com/public/basic', { className: 'holiday' }), //General events 'events.php?a=getAllCalendarEvents' ], The problem that I am having is, I can get the gCalFeed to have a className, but not exactly sure how to get my other source to have a className... Any ideas would be greatly appreciated.

    Read the article

  • Titanium TableViewRow classname with custom rows

    - by pancake
    I would like to know in what way the 'className' property of a Ti.UI.TableViewRow helps when creating custom rows. For example, I populate a tableview with custom rows in the following way: function populateTableView(tableView, data) { var rows = []; var row; var title, image; var i; for (i = 0; i < data.length; i++) { title = Ti.UI.createLabel({ text : data[i].title, width : 100, height: 30, top: 5, left: 25 }); image = Ti.UI.createImage({ image : 'some_image.png', width: 30, height: 30, top: 5, left: 5 }); /* and, like, 5+ more views or whatever */ row = Ti.UI.createTableViewRow(); row.add(titleLabel); row.add(image); rows.push(row); } tableView.setData(rows); } Of course, this example of a "custom" row is easily created using the standard title and image properties of the TableViewRow, but that isn't the point. How is the allocation of new labels, image views and other child views of a table view prevented in favour of their reuse? I know in iOS this is achieved by using the method -[UITableView dequeueReusableCellWithIdentifier:] to fetch a row object from a 'reservoir' (so 'className' is 'identifier' here) that isn't currently being used for displaying data, but already has the needed child views laid out correctly in it, thus only requiring to update the data contained within (text, image data, etc). As this system is so unbelievably simple, I have a lot of trouble believing the method employed by the Titanium API does not support this. After reading through the API and searching the web, I do however suspect this is the case. The 'className' property is recommended as an easy way to make table views more efficient in Titanium, but its relation to custom table view rows is not explained in any way. If anyone could clarify this matter for me, I would be very grateful.

    Read the article

  • Use JavaScript to Replace Classname Value

    - by user1515425
    I want to replace every occurrence of the numbers with the string: ???. Here is an example string: <em>Chelsea</em> 1-4 Atletico Madrid How can I do this in JavaScript? <a href="https://www.google.com/url?sa=t&amp;source=web&amp;cd=9&amp;cad=rja&amp;ved=0CFEQtwIwCA&amp;url=http%3A%2F%2Fwww.whoateallthepies.tv%2Fchelsea%2F137070%2Fsuper-cup-chelsea-1-4-atletico-madrid-falcao-on-fire-as-blues-flop-in-monaco-photos-highlights.html&amp;rct=j&amp;q=chelsea&amp;ei=1odBUImpBIWA0AWM1oC4BA&amp;usg=AFQjCNEwdCCckt15XTkHSAf2fsUnGk9IJg&amp;sig2=IOrD6hfMrviW9ods0DG2dw" class="l" onmousedown="return rwt(this,'','0','','9','AFQjCNEwdCCckt15XTkHSAf2fsUnGk9IJg','IOrD6hfMrviW9ods0DG2dw','0CFEQtwIwCA',null,event)" title="Super Cup: Chelsea 1-4 Atletico Madrid – Falcao On Fire As Blues Flop In Monaco (Photos ...">Super Cup: <em>Chelsea</em> 1-4 Atletico Madrid – Falcao On <b>...</b></a> Thanks in advance.

    Read the article

  • How do I get element's className inside loop of elements?

    - by crosenblum
    I am doing a loop of all elements inside a div, and I now need to get the classname of the element that I am looping by. Then i can check if the current element's class is one, I need to do something with... // var children = parent.childNodes, child; var parentNode = divid; // start loop thru child nodes for(var node=parentNode.firstChild;node!=null;node=node.nextSibling){ var myclass = (node.className ? node.className.baseVal : node.getAttribute('class')); } But this code for getting the classname only get's null values. Any suggestions?

    Read the article

  • What does this mean: warning: converting from ‘void (ClassName::*)()’ to ‘void (*)()’

    - by Brendan Long
    I have a member function in a class that has a callback, but the callback isn't strictly neccessary, so it has a default callback, which is empty. It seems to work fine, but I get an annoying warning: warning: converting from ‘void (ClassName::*)()’ to ‘void (*)()’ I'm trying to figure out what it means and how to turn it off (or fix it if I really am doing something wrong). Here's some simple code: class ClassName{ public: void doSomething(void (*callbackFunction)() = (void(*)()) &ClassName::doNothing){ callbackFunction(); } void doNothing(){} }; int main(){ ClassName x; x.doSomething(); return 0; } Note: If I do this (without explicitly casting it as a void(*)()): void doSomething(void (*callbackFunction)() = &ClassName::doNothing) I get this: main.cpp:3: error: default argument for parameter of type ‘void (*)()’ has type ‘void (ClassName::*)()’

    Read the article

  • jQuery - discrepency between classname and selectors

    - by Ciel
    I have the following code that I wrote, which I personally found to be pretty nice. It takes a <ul> and it drops down the contents when clicked. But I am having a disconnect here in comprehension, and one I had to do what I feel is a 'dirty hack' to solve. The problem is that I do not want the class `'sidebar-dropdown-open' to be so 'hardwired' in the plugin. However I discovered that there is a very stark difference between... $('.sidebar-dropdown-open') and 'sidebar-dropdown-open and even '.sidebar-dropdown-open. I 'solved' this problem by including two different 'parameters' in my plugin, but I was wondering if someone might give me some insight as to how I could perform this better, and why this was behaving this way. wiring (document load) $(document).ready(function () { $('[data-role="sidebar-dropdown"]').drawer({ open: 'sidebar-dropdown-open', css: '.sidebar-dropdown-open' }); }); html <ul> <li class=" dropdown" data-role="sidebar-dropdown"> <a href="pages/.." class="remote">Link Text</a> <ul class="sub-menu light sidebar-dropdown-menu"> <li><a class="remote" href="pages/...">Link Text</a></li> <li><a class="remote" href="pages/...">Link Text</a></li> <li><a class="remote" href="pages/...">Link Text</a></li> </ul> </li> </ul> javascript (function ($) { $.fn.drawer = function (options) { // Create some defaults, extending them with any options that were provided var settings = $.extend({ open: 'open', css: '.open' }, options); return this.each(function () { $(this).on('click', function (e) { // slide up all open dropdown menus $(settings.css).not($(this)).each(function () { $(this).removeClass(settings.open); // retrieve the appropriate menu item var $menu = $(this).children(".dropdown-menu, .sidebar-dropdown-menu"); // slide down the one clicked on. $menu.slideUp('fast'); $menu.removeClass('active'); }); // mark this menu as open $(this).addClass(settings.open); // retrieve the appropriate menu item var $menu = $(this).children(".dropdown-menu, .sidebar-dropdown-menu"); // slide down the one clicked on. $menu.slideDown(100); $menu.addClass('active'); e.preventDefault(); e.stopPropagation(); }).on("mouseleave", function () { $(this).children(".dropdown-menu").hide().delay(300); }); }) }; })(jQuery); I have tried using settings.open and demanding that it just be a className (.open), etc. - but that does not seem to work. It seems to get ignored by the removeClass function.

    Read the article

  • Reliable way to get the "ancestor" of an object with a specific classname, using jQuery

    - by Matt Dawdy
    I've got a javascript function that gets called on change event of a select form element. So, the "this" variable in js refers to the select element. This select element is in a td tag, in a tr tag. The tr tag has a classname of "FilterDetailsRow". Now, I've tested, and if I use this syntax: var filterRow = $(this).parent().parent(); it gets me what I want. However, is there a better way to tell jQuery, "starting with "this" can you please go up my tree of parents until you find one with a classname of "FilterDetailsRow"? Here's what I came up with, but I want to make sure I"m not reinventing the wheel. function GetFilterDetailsRowOfObject(o) { if (o) { if (o.parent()[0].className.indexOf("FilterDetailsRow") != -1) return o; else return GetFilterDetailsRowOfObject(o.parent()); } else { return null; } } Thanks for any advice.

    Read the article

  • className method?

    - by fuzzygoat
    I have just been watching the Stanford iPhone lecture online from Jan 2010 and I noticed that the guy from Apple keeps referring to getting an objects class name using "className" e.g. NSArray *myArray = [NSArray arrayWithObjects:@"ONE", @"TWO", nil]; NSLog(@"I am an %@ and have %d items", [myArray className], [myArray count]); However, I can't get this to work, the closest I can come up with it to use class, is className wrong, did it get removed, just curious? NSArray *myArray = [NSArray arrayWithObjects:@"ONE", @"TWO", nil]; NSLog(@"I am an %@ and have %d items", [myArray class], [myArray count]); Gary

    Read the article

  • Does className exist in Mootools ?

    - by anna mae
    Hi, I want to update this very simple JS to Mootools 1.2 and it's not easy. This function : function changeclass(x){ document.getElementById("content").className = "ziclass0"; document.getElementById("content").className = "ziclass" + x; } is triggered in the DOM by : <div id="someclass"> a href="javascript: changeclass(0)">Unstyled</a a href="javascript: changeclass(1)">link one</a a href="javascript: changeclass(2)">link two</a a href="javascript: changeclass(3)">link three</a </div> to call the according CSS classes like : .ziclass1 h1{ color: rgb(142,11,0); font-family: Verdana; font-size: 2.5em; letter-spacing: 0.1em; } and changes the layout accordingly in : <div id="content" class="ziclass3"> ... </div> I know I can add an event to the triggers like : $(#someclass.each(function(element,index) { element.addEvent('click', function(){ //some code }); But, how do I get #content class classname ? Through an array ? I am a bit confused here. I'd be really grateful for any help to set me on the right track

    Read the article

  • jquery: if ul has li with certain classname?

    - by mathiregister
    hi guys, i wonder how i can query if a ul has a first-child li with a certain classname? like… <ul> <li>list element 1</li> <li>list element 2</li> </ul> <ul> <li class="whatever">list element 1</li> <li>list element 2</li> </ul> i want to query if ul has a child with classname whatever - do something! is that even possible? thank you

    Read the article

  • get html content of next element with a defined classname

    - by Carasuman
    i have problems with jquery.. If i have this code to fill tooltip div <div id="tooltip"></div> <div class="tooltipMessage">Tooltip Message</div> <script type="text/javascript"> $("#id").html($("#tooltip").next(".tooltipMessage").html()); </script> Works, the code takes the next element with classname "tooltipMessage" and fills element with id "tooltip". But if i have this code: <div id="tooltip"></div> <p>other element</p> <div class="tooltipMesage">Tooltip Message</div> Returns "undefined". How i can take html from the next element with classname "tooltipMessage" if exists another element in middle ? Thanks for help!.

    Read the article

  • Remove <p class="classname"> in Javascript?

    - by streetparade
    How can i remove this <p> tag with all its content in javascript? say i have this html code <p class="classname"> <input name="commit" value="Get Value" type="submit"> <span>or Cancel</span> </p> Now i need to replace/remove it in javascript, does anyone know how i can remove it?

    Read the article

  • Javascript - document.links.className ?

    - by Slevin
    I have a Javascript question that I am curious about. When using: var test = document.links(arrayNum).name; Is it possible to dig deeper into specifying links? For instance, if there is just a group of links from within a div with an id that you would like to target as opposed to all the links on the page could you write something like: var test = document.getElementById('divId').links(arrayNum).name; Or could I add a class to the statement to target only the links associated with it? var test = document.links.className(arrayNum).name; Is anything like this feasible?

    Read the article

  • No persister for: <ClassName> issue with Fluent NHibernate

    - by Amit
    I have following code: //AutoMapConfig.cs using System; using FluentNHibernate.Automapping; namespace SimpleFNH.AutoMap { public class AutoMapConfig : DefaultAutomappingConfiguration { public override bool ShouldMap(Type type) { return type.Namespace == "Examples.FirstAutomappedProject.Entities"; } } } //CascadeConvention.cs using FluentNHibernate.Conventions; using FluentNHibernate.Conventions.Instances; namespace SimpleFNH.AutoMap { public class CascadeConvention : IReferenceConvention, IHasManyConvention, IHasManyToManyConvention { public void Apply(IManyToOneInstance instance) { instance.Cascade.All(); } public void Apply(IOneToManyCollectionInstance instance) { instance.Cascade.All(); } public void Apply(IManyToManyCollectionInstance instance) { instance.Cascade.All(); } } } //Item.cs namespace SimpleFNH.Entities { public class Item { public virtual long ID { get; set; } public virtual string ItemName { get; set; } public virtual string Description { get; set; } public virtual OrderItem OrderItem { get; set; } } } //OrderItem.cs namespace SimpleFNH.Entities { public class OrderItem { public virtual long ID { get; set; } public virtual int Quantity { get; set; } public virtual Item Item { get; set; } public virtual ProductOrder ProductOrder { get; set; } public virtual void AddItem(Item item) { item.OrderItem = this; } } } using System; using System.Collections.Generic; //ProductOrder.cs namespace SimpleFNH.Entities { public class ProductOrder { public virtual long ID { get; set; } public virtual DateTime OrderDate { get; set; } public virtual string CustomerName { get; set; } public virtual IList<OrderItem> OrderItems { get; set; } public ProductOrder() { OrderItems = new List<OrderItem>(); } public virtual void AddOrderItems(params OrderItem[] items) { foreach (var item in items) { OrderItems.Add(item); item.ProductOrder = this; } } } } //NHibernateRepo.cs using FluentNHibernate.Cfg; using FluentNHibernate.Cfg.Db; using NHibernate; using NHibernate.Criterion; using NHibernate.Tool.hbm2ddl; namespace SimpleFNH.Repository { public class NHibernateRepo { private static ISessionFactory _sessionFactory; private static ISessionFactory SessionFactory { get { if (_sessionFactory == null) InitializeSessionFactory(); return _sessionFactory; } } private static void InitializeSessionFactory() { _sessionFactory = Fluently.Configure().Database( MsSqlConfiguration.MsSql2008.ConnectionString( @"server=Amit-PC\SQLEXPRESS;database=SimpleFNH;Trusted_Connection=True;").ShowSql()). Mappings(m => m.FluentMappings.AddFromAssemblyOf<Order>()).ExposeConfiguration( cfg => new SchemaExport(cfg).Create(true, true)).BuildSessionFactory(); } public static ISession OpenSession() { return SessionFactory.OpenSession(); } } } //Program.cs using System; using System.Collections.Generic; using System.Linq; using SimpleFNH.Entities; using SimpleFNH.Repository; namespace SimpleFNH { class Program { static void Main(string[] args) { using (var session = NHibernateRepo.OpenSession()) { using (var transaction = session.BeginTransaction()) { var item1 = new Item { ItemName = "item 1", Description = "test 1" }; var item2 = new Item { ItemName = "item 2", Description = "test 2" }; var item3 = new Item { ItemName = "item 3", Description = "test 3" }; var orderItem1 = new OrderItem { Item = item1, Quantity = 2 }; var orderItem2 = new OrderItem { Item = item2, Quantity = 4 }; var orderItem3 = new OrderItem { Item = item3, Quantity = 5 }; var productOrder = new ProductOrder { CustomerName = "Amit", OrderDate = DateTime.Now, OrderItems = new List<OrderItem> { orderItem1, orderItem2, orderItem3 } }; productOrder.AddOrderItems(orderItem1, orderItem2, orderItem3); session.Save(productOrder); transaction.Commit(); } } using (var session = NHibernateRepo.OpenSession()) { // retreive all stores and display them using (session.BeginTransaction()) { var orders = session.CreateCriteria(typeof(ProductOrder)) .List<ProductOrder>(); foreach (var item in orders) { Console.WriteLine(item.OrderItems.First().Quantity); } } } } } } I tried many variations to get it working but i get an error saying No persister for: SimpleFNH.Entities.ProductOrder Can someone help me get it working? I wanted to create a simple program which will set a pattern for my bigger project but it is taking quite a lot of time than expected. It would be rally helpful if you can explain in simple terms on any template/pattern that i can use to get fluent nHibernate working. The above code uses auto mapping, which i tried after i tried with fluent mapping.

    Read the article

  • Simple Prototype.js code to select multiple elements with the same classname

    - by stephemurdoch
    I have one link with an id of "link", and I use the javascript below to open that link up in a modalbox: #In my template I have: <a href="some/path" id="link">link</a> #Then in my application.js file I have: document.observe('dom:loaded', function() { $('login-link').observe('click', function(event) { event.stop(); Modalbox.show(this.href,{title: 'some title', width: 500}); }); }) Since id's must be unique, this javascript only works for one element per page so I use it to observe my login-link and it has served me well. Until now. I want to use the same javascript to observe multiple links which have classnames instead of id's as below: <a href="link/to/some/stuff" class="link">link 1</a> <a href="link/to/some/other/stuff" class="link">link 2</a> When I do this, I can't get any of the links to open in a modalbox. If I change the class to an id for each link, then I can get the first link in the list to open in a modalbox. I've tried to use the '$$' notation to build an array of links in my javascript (shown below) but if I do that, then none of the links open correctly #document.observe method removed for display purposes $$('link').observe('click', function(event) { event.stop(); Modalbox.show(this.href,{title: 'some title', width: 500} ); }); My javascript skills obviously suck. Does anyone know how to fix the problem?

    Read the article

  • C++ 'ClassName Not Declared' Error

    - by Arjun Nayini
    I have this cpp file. dsets.cpp: #ifndef DSETS_CPP #define DSET_CPP //Adds elements to the DisjointSet data structure. This function adds //x unconnected roots to the end of the array. void DisjointSets::addelements(int x){ } //Given an int this function finds the root associated with that node. int DisjointSets::find(int x){ return 0; } //This function reorders the uptree in order to represent the union of two //subtrees void DisjointSets::setunion(int x, int y){ } #endif and this header file dsets.h: #ifndef DSETS_H #define DSET_H #include <iostream> #include <vector> using namespace std; class DisjointSets { public: void addelements(int x); int find(int x); void setunion(int x, int y); private: vector<int> x; }; #include "dsets.cpp" #endif And I keep getting an error that is saying that "DisjointSets has no been declared" ~ ~

    Read the article

  • expecte ')' before className

    - by Akbarbuneri
    Hi I have a class DataObject as Header ::: #import <Foundation/Foundation.h> @interface DataObject : NSObject { NSString *erorrMessage; BOOL hasError; NSDictionary *dataValues; } @property(nonatomic, retain)NSString *erorrMessage; @property(nonatomic)BOOL hasError; @property(nonatomic, retain)NSDictionary *dataValues; @end Class Implementation:::: #import "DataObject.h" @implementation DataObject @synthesize erorrMessage; @synthesize hasError; @synthesize dataValues; @end And I have another class as DataManager Header as :::: #import <Foundation/Foundation.h> @interface DataManager : NSObject - (DataObject *)getData :(NSString*)url; @end Implementation :::: #import "DataManager.h" #import "DataObject.h" #import "JSON.h" @implementation DataManager - (DataObject *)getData :(NSString*)url{ DataObject* dataObject = [[DataObject alloc]init]; NSString *urlString = [NSString stringWithFormat:url]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]; //TODO: Here we have to check the internet connection before requesting. NSError * erorrOnRequesting; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&erorrOnRequesting]; NSString* responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; if( erorrOnRequesting != nil) { dataObject.hasError = YES; dataObject.erorrMessage = @"Error on requsting to the web server"; return dataObject; } NSError *errorOnParsing; SBJSON *json = [[SBJSON new] autorelease]; NSDictionary *dataValues = [json objectWithString:responseString error:&errorOnParsing]; [responseString release]; if(errorOnParsing != nil) { //TODO: We have to send the website a feedback that there is some problem on the server end. dataObject.hasError = YES; dataObject.erorrMessage = @"Error on parsing, the server returned invalid data."; return dataObject; } dataObject.hasError = NO; dataObject.dataValues = dataValues; return dataObject; } @end Now when I build I got an error in the DataManager header where I #import Dataobject header, it says "error: expected')' before DataObject" I don;t understand what I miss. Thanks for the help..

    Read the article

  • "error: Expected a type, got 'classname'" in C++

    - by Bay
    Using the following code: template <typename T> class node { [. . .] }; class b_graph { friend istream& operator>> (istream& in, b_graph& ingraph); friend ostream& operator<< (ostream& out, b_graph& outgraph); public: [...] private: vector<node> vertices; //This line I'm getting: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Alloc> class std::vector’ error: expected a type, got 'node' error: template argument 2 is invalid On the indicated line. Node is clearly defined before b_graph which uses it - what have I done here?

    Read the article

  • class classname(value); & class classname=value; difference when constructor is explicit

    - by Mahesh
    When constructor is explicit, it isn't used for implicit conversions. In the given snippet, constructor is marked as explicit. Then why in case foo obj1(10.25); it is working and in foo obj2=10.25; it isn't working ? #include <iostream> class foo { int x; public: explicit foo( int x ):x(x) {} }; int main() { foo obj(10.25); // Not an error. Why ? foo obj2 = 10.25; // Error getchar(); return 0; } error: error C2440: 'initializing' : cannot convert from 'double' to 'foo'

    Read the article

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