Bug Tracker

Opened 9 years ago

Closed 9 years ago

#8455 closed bug (invalid)

jQuery(html,props) doesn't updates the dom or something like that...

Reported by: Nicko Owned by:
Priority: undecided Milestone: 1.next
Component: manipulation Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

when I try to check the existence of the created element by jQuery( html, props ) i gets 'false'.

i use .length for check element for existence. see example:
demo: http://jsbin.com/afopi3
editcode: http://jsbin.com/afopi3/edit

$(document).ready(function(){
	$("#show_testbox").live("click", function(){

		var element = $('#test_box');
		if (!element.length) { 
 		
			$('<div/>', {
					id: '#test_box',
					css: {
					width: '80px',
					height: '80px',
					backgroundColor: '#f00',
					margin: '10px'
					}
				}).appendTo('body');  
			
		}
		else {(alert('This element already created'))}

	});
	
}); // doc ready [end]

but if i use jQuery( html, [ ownerDocument ] ) as the alternative - all works fine (click fnc create the element '#text_box' only one time)
demo: http://jsbin.com/efoga5
editcode: http://jsbin.com/efoga5/edit

$(document).ready(function(){
	$("#show_testbox").live("click", function(){

		var element = $('#test_box');
		if (!element.length) { 

			$('body').append('<div id="test_box"></div>'); 
			$('#test_box').css({
					width: '90px',
					height: '90px',
					backgroundColor: '#f00',
					margin: '10px'
			})

		}
		else {(alert('This element already created'))}

	});
	
}); // doc ready [end]


so, is it a bug?
or what i do wrong and why jQuery( html, props ) works not like jQuery( html, [ ownerDocument ] )

... any reply are welcome and thanx for your attention )

Change History (2)

comment:1 Changed 9 years ago by Nicko

UPD: sorry guys! there is no bug, it's my mistake, i use 'id' option wrong (was need remove '#')...

realy lol... please del this ticket )

comment:2 Changed 9 years ago by Rick Waldron

Component: unfiledmanipulation
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.