how to add space in javascript?

Discussion in 'JavaScript' started by baris22, Feb 20, 2011.

  1. #1
    hello all,

    i could not add a space on submit button. I tried

    
     
    
    Code (markup):
    but did not work. how to do this on javascript?

    
                    $('#dialog').dialog({
    				
    				
                        autoOpen: false,
                        width: 900,
    					height: 700,
                        modal: true,
                        resizable: false,
                        buttons: {
                            "  ----- Submit Form -----": function() {
                                document.myform.submit();
    							
                            },
                            "Cancel": function() {
                                $(this).dialog("close");
                            }
                        }
                    });
    
    Code (markup):
     
    baris22, Feb 20, 2011 IP
  2. buzenko

    buzenko Peon

    Messages:
    93
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ...................
    \xa0
    Code (markup):
     
    buzenko, Feb 20, 2011 IP
  3. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    thanks alot it works perfect. What about the line break? <br> does not work


     
    baris22, Feb 20, 2011 IP
  4. buzenko

    buzenko Peon

    Messages:
    93
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ..................................
    
    \n
    
    Code (markup):
     
    buzenko, Feb 20, 2011 IP
  5. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #5
    you mean jQuery, but just a normal space should work.... no need for special characters necessary for a space when using javascript.. i don't see why jQuery would be different. But for a line break \n should work as mentioned above.
     
    camjohnson95, Feb 21, 2011 IP
  6. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    you can add padding via the style values for your button
     
    srisen2, Feb 22, 2011 IP
  7. Daws0n

    Daws0n Peon

    Messages:
    384
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    <br /> is for html
    /n is for Java Script as stated above
     
    Daws0n, Feb 22, 2011 IP
  8. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #8
    when i used just normal space it did not work. I needed more than 1. \xa0 worked perfect. when i used \n it did not work. I sorted out using css. Any idea why \n did not work?

    
    buttons: {
                            "\xa0 \xa0 ----- Submit Form ----- \xa0 \xa0": function() {
                                document.myform.submit();
    							
                            },
    
    
    Code (markup):
     
    baris22, Feb 25, 2011 IP
  9. AtSeaDesign

    AtSeaDesign Active Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    93
    #9
    I've had luck with \r and \n
     
    AtSeaDesign, Feb 25, 2011 IP
  10. AtSeaDesign

    AtSeaDesign Active Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    93
    #10
    &nbsp is not valid &nbsp; is. I've had no issues using it cross browser. If you want a space, why not use + ' ' +?

    And we're you referring to Mozilla based browsers? Netscape died years ago.
     
    AtSeaDesign, Mar 4, 2011 IP
  11. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #11
    does netscape still exist does it ?
     
    camjohnson95, Mar 5, 2011 IP