> For the complete documentation index, see [llms.txt](https://yugalphp.gitbook.io/php/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yugalphp.gitbook.io/php/frontend-ssg-spa/yugal-js-functions.md).

# Yugal JS Functions

These functions are only valid for JavaScript part of the app.

## yugal.title(title)

Sets/Updates the title of the page. Accepts one string as parameter. Returns current page title if nothing passed.

## yugal.header(head\_html);

Injects page specific `<head>` code to DOM. Code injected by this function is removed when page is navigated.

## yugal.$(element\_key);

Similar to jQuery, this element return respective element. It accepts only one parameter in `string` You can provide class name/id/tag name in it just like CSS rule.

Example

```javascript
const {$} = yugal;
console.log($("#mydiv")); //RETURN element with mydiv id
console.log($(".someclass")); //RETURNS element with 'someclass' class name
console.log($("div")); //Returns div tag

//Usage
$("#mydiv").innerHTML = `<h1>Hello World</h1>`;
```

{% hint style="info" %}
From Yugal 9.1, other extra functions from Yugal's built in module `yugal.js` in `modules/` directory are moved to external libray [here](https://github.com/sinhapaurush/yugalmods).
{% endhint %}
