Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript how to set a class and id to a div that don't affect each other by jquery?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #203708
    jackson
    Participant

    made a simple chat room. i want the comment to have different parts so i use this code to set an id and class to a div

    $(‘

    ‘+inpx+’

    ‘).addClass(‘showMessage’).appendTo(‘#mainbox’);

    i use #fullBox to say you have a div that has larger space and i use .showMessage to say to it you have smaller space to hold the text.

    therefor i can use that larger space to add some element later.

    style of my id and class

    #fullBox{
    width:1100px;
    margin:5px;
    background-color:#fff;
    }
    and my class

    .showMessage{
    width :1000 px;
    background-color:#03C;
    word-wrap:break-word;
    line-height :1.3 em;
    font-size :24 px;
    }
    my id has larger space and i expect that my class with smaller space hold my text but my text follow my id i don’t know how to solve it.

    i use two different background color to see both of them if i can see both of them i get my answer.

    link code :jsfiddle

    #203710
    Paulie_D
    Member

    I’m not sure what it is you are trying to do.

    I’m wondering if you have an image of what this is supposed to look like?

    #203726
    Paulie_D
    Member

    @traq

    For my own benefit can you explain what the OP was actually asking?

    I get the ID/Class disparity but the actual intent here…I just don’t understand.

    #203731
    jackson
    Participant

    thank you for reply. i understand how to solve it, i was not friend with Append() at first i should use append to add my classes to div. i want to have report icon to every comment in my chat room so i should use two classes on smaller to hold text and bigger to add some element like Report icon. i put my project until now in bottom. i hope by using your help one day i will finish my chat room and share it free for everyone, i wish so.

    code link:jsfiddle

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.