# Styling

jQuery allows us to change the style of DOM elements with .css(\[property],\[value]);

```javascript
$("#myDiv").css("color", "red");
```

We can change several elements at once too:

```javascript
$("div").css("background", "yellow");
```

But that seems kind of boring. I mean, what if we want to do something with less hard-coding using jQuery.

```javascript
//returns a random value 0-255;
var randColorValue = function() {
  return Math.floor( Math.random() * 255 );
}

//assigns a random color value to three different variables and returns a proper rgb value
var randColor = function() {
  var red = randColorValue();
  var green = randColorValue();
  var blue = randColorValue();

  return "rgb(" + red + "," + green + "," + blue + ")";
}

$("#myDiv").css("color", randColor());
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://romebell.gitbook.io/seirfx-621/jquery/jquery-intro/03styling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
