Solved

jQuery value within div undefined

Posted on 2016-11-08
3
37 Views
Last Modified: 2016-11-08
When I query my page in the console,  I get back the innerhtml.  However, when I try to do this in a routine, the value I get back is undefined.

The code follows:
$('.testimonial').each (function() {
					var el = this;
					var rawhtml=el.innerhtml;
					el.innerhtml = CleanHTMLBody(rawhtml);					
				});

Open in new window


I can see "el" in the console has a div, but the innerhtml assignment fails and rawhtml is undefined.

Please advise.
0
Comment
Question by:Howard Bash
3 Comments
 
LVL 8

Accepted Solution

by:
Paweł earned 500 total points
ID: 41878910
try el.innerHTML

instead of
el.innerhtml

http://www.w3schools.com/jsref/prop_html_innerhtml.asp
0
 
LVL 52

Expert Comment

by:Julian Hansen
ID: 41878918
If you are using jQuery why are you using innerHTML
What does CleanHTMLBody do?
$('.testimonial').each (function(i, el) {
  var html = CleanHTMLBody($(e).html());
   $(e).html(html);
});

Open in new window

0
 
LVL 1

Author Closing Comment

by:Howard Bash
ID: 41878919
Duh.  Thanks.  It was a case of wrong case. ;-)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn how to dynamically set the form action using jQuery.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now