Question: So I am trying to add some images dynamically that are uploaded from pc to a gallery div. But when I add them with their class names, their styling is the default and not their class styling. 
I know that I can add the styling dynamically when adding the image but the styling of the class is very large. Is there any possible way we can add the styling of the class but not when we add the image?

```js
function uploadImage(){
 var appendedText="<div class='p-item grid-sizer'><a class='venobox' href='images/porfolio-16-300x500.jpg'><img src='images/porfolio-16-300x500.jpg' alt=''/></a></div>";
 var x=document.getElementsByClassName("p-grid-isotope");
 x[0].appendChild(appendedText);
}
```

```html
<section class="main-section" >
    <div class="p-grid-isotope" >
     <div class="p-item grid-sizer" ></div>

    </div>
</section>

<button type="submit" id="upload-img" class="following-button" style="color: white; margin-top: 30px; margin-left: 18%" onclick="uploadImage()"><span class="icons i1"><i class="fa fa-upload" aria-hidden="true"></i></span>Upload to account</button>
```

Answer: 
As comments have pointed out, you have typos in the code. What you probably are trying to achieve is something like:

```js
function sqrtUserNum() {
  let userNum;

  for (;;) {
    userNum = parseFloat(prompt("Give me a number and I'll tell you it's square-root."));
    if (!isNaN(userNum))
      break;
    alert("The number was not valid!");
  }

  alert(Math.sqrt(userNum));
}

sqrtUserNum()
```

In other words, you want to alert the user that the number was invalid and try again, until you get an actual number.
At first, you had some typos in your code.

If you want to keep requesting a number if the user does not enter one, I modified your script to do exactly that. (I can't really tell from your question):

```js
function sqrtUserNum() {
  let userNum = parseFloat(prompt("Give me a number and I'll tell you it's square-root."));
  while (isNaN(userNum)) {
    alert("NaN");
    userNum = parseFloat(prompt("Please enter a number."));
  }
  alert(Math.sqrt(userNum));
}
sqrtUserNum();
```

---

In case you do not want to do that, this should do it:

```js
function sqrtUserNum() {
  let userNum = parseFloat(prompt("Give me a number and I'll tell you it's square-root."));
  if (isNaN(userNum)) {
    alert("NaN");
    userNum = parseFloat(prompt("Give me a number and I'll tell you it's square-root."));
  }
  if (!isNaN(userNum)) {
    alert(Math.sqrt(userNum));
  }
}
sqrtUserNum();
```