Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
DOM insertion with jquery or javascript
15/10/2010
19:19
Avatar
Octavient
Member
Members
Forum Posts: 9
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

I'm struggling to insert elements into jqgrid cells using jquery or javascript--I get "object Object" appearing in the jqgrid cell, instead of the <span> object I should be seeing, even though my syntax seems to be correct.  

I'm using logic I found in this forum on a slightly different question, with an answer posted by Tony--it had to do with how to find the TD element and bind a click function to it.  I'm using the same logic, but instead of binding a click function, I'm trying to append a DOM object to the TD.  This syntax works fine when I'm appending simple html content--but not when I'm appending an object (span, div, img, etc.).  Does it have to do with the sequence in which the DOM is initialized?

The code is:  (using version 3.7.2 and XML)

afterInsertRow: function (rowid, data) {

var objSpan = document.createElement("span");

var txtSpan = document.createTextNode("hi, I am some text");

objSpan.appendChild(txtSpan);

 

$("td:eq(0)","#"+rowid).append(objSpan);

}

 

Instead of seeing "hi, I am some text" rendered in span tags by the browser, I'm seeing "object Object."  

Suggestions?

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
59 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information