0

I am looking to remove the break after an H1 element as well as a way to implement a backspace in JavaScript

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
nerdsville
  • 78
  • 6

3 Answers3

1

If, by "remove the break," you mean not start a new line, add CSS like this:

h1 {display: inline;}

If you don't want all H1 to be that way, use a class.

As far as "implement a backspace," you will need to explain what you want to accomplish before anyone can help very much.

Bob Brown
  • 1,463
  • 1
  • 12
  • 25
  • Ah thanks, not really good at CSS :p, as for implement a backspace, basically insert a backspace character with JavaScript to remove a character – nerdsville Aug 24 '14 at 14:00
  • You can just remove the character without the need of a backspace if you know where the character is, and you need to know where it is to inert the backspace. Is that what you're trying to do? – Bob Brown Aug 24 '14 at 14:02
  • Yeah it would just be one space behind the caret – nerdsville Aug 24 '14 at 14:03
  • Have a look at this: http://stackoverflow.com/questions/9932957/javascript-remove-character-from-a-string – Bob Brown Aug 24 '14 at 14:04
  • Thank you :) sorry for the poor wording, you answered the questions perfectly though! – nerdsville Aug 24 '14 at 14:06
1

You can change the CSS style of the H1 element to come to this result. It is explained here: https://stackoverflow.com/a/9361133/2433843

h1 {
    display: inline;
}

For your second part of the question, implementing a backspace, I am not sure what you mean. Perhaps you would like to strip spaces?

Community
  • 1
  • 1
Francesco de Guytenaere
  • 4,443
  • 2
  • 25
  • 37
0

This is for implementing backspace behaviour.

function RemoveBackspaces(str)
{
while (str.indexOf("\b") != -1)
{
    str = str.replace(/.?\x08/, ""); // 0x08 is the ASCII code for \b
}
return str;
}


   Use it like this:

   var str = RemoveBackspaces(f("\b\byz")); // returns "ayz"
MANU
  • 1,358
  • 1
  • 16
  • 29