Hard with my JS / jQuery creating div

I am creating a short message for this web application to learn JavaScript and jQuery, because I was told that it would be a good project, so I have a couple of errors and don’t know how to fix them. I'm new to StackOverflow - I use it more as a link than anything.

This is the code: http://pastebin.com/raw.php?i=67i5HwY5

Problem: -When adding multiple posts will spoil the div.

I have ideas on how to fix this, I'm just new to jQuery and JS, so I don't know how to apply them. If you guys could help me, that would be great.

Thank!

http://jsfiddle.net/mitchbregs/fYTFV/5/

+5
source share
3 answers

: http://jsfiddle.net/mattblancarte/fYTFV/12/

.:) , , , post-it.

... $( "# postIt-" + id) , :

var postit = $("#postIt-" + id);
postit.css();

css , :

postit.css({
  'background' : 'blue',
  'height' : '100px',
  //etc.
});
+3

$("#header").append("<div id='urlPost' 

? . .

'id' 0.

:

$("#header").append("<div id='urlPost" + id + "' class='etc'");

$("#urlPost"+id).css("width",wh);

:

id++;

, , , css .

0

Hey, just to answer your question .. I made a decision using only jquery. This may be another solution in which you do not need to declare var. Here it is .. http://jsfiddle.net/vwPDr/

I used the latest jquery selector and applied it to the draggble class. check it out.

0
source

All Articles