Jump to content

Jquery Html()


GoodLife

Recommended Posts

I'm fairly new to jQuery and trying to write some code to replace the inner HTML of an element. The element is dynamically created. I would expect the inner HTML of the element with the id of type+".title" to be "hello" after the code is run but it is "test1". The plain javascript is working but the jQuery isn't. Any ideas about why the jQuery isn't working would be much appreciated. Thanks!

function edit(type){	var sectionId = "#"+type;	if($(sectionId).attr("type") == "section")	{		document.getElementById(type+".title").innerHTML = "test1";		$("#"+type+".title").html("hello");	}}

Link to comment
Share on other sites

Guest FirefoxRocks

In your HTML code, is the ID of the element "type.title" or "type"? (whatever type is)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...