Jump to content

Jquery Html()


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...