Skip to main content

Bug Tracker

Side navigation

#8455 closed bug (invalid)

Opened March 06, 2011 09:45PM UTC

Closed March 06, 2011 11:40PM UTC

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 )

Attachments (0)
Change History (2)

Changed March 06, 2011 11:39PM UTC by Nicko comment:1

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 )

Changed March 06, 2011 11:40PM UTC by rwaldron comment:2

component: unfiledmanipulation
resolution: → invalid
status: newclosed