Anchor search Property
Example
Return the querystring part of a link:
var x = document.getElementById("myAnchor").search;
Try it Yourself »
Definition and Usage
The search property sets or returns the querystring part of the href attribute value.
The querystring is the part of the URL after the question mark (?). This is often used for parameter passing.
Browser Support
Property | |||||
---|---|---|---|---|---|
search | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the search property:
anchorObject.search
Set the search property:
anchorObject.search = querystring
Property Values
Value | Description |
---|---|
querystring | Specifies the search part of a URL |
Technical Details
Return Value: | A String, representing the querystring part of the URL, including the question mark (?) |
---|
More Examples
Example
Change the querystring part of a link:
document.getElementById("myAnchor").search = "somenewsearchvalue";
Try it Yourself »
Related Pages
JavaScript reference: location.search Property
❮ Anchor Object