Question

I am using the Quicksand jquery scripts on an HTML page and using simple select controls:

<select name="sort" style="vertical-align:middle;" id="cboSort">
    <option value="1" selected="selected">Low to High</option>
    <option value="2">High to Low</option>
</select>

I want to be able to have the quicksand scripts run on page load but I have no idea how to do that, I am learning javascript so I am a bit confused. Basically I want the items to be already sorted from Low to High on page load. This is a simple one page website.

please help

Was it helpful?

Solution 3

this was fixed using autoselect and variable switch

OTHER TIPS

You can wrap the code you want to run in jQuery's $(document).ready() construct:

$(document).ready(function() {
    // Your code goes here...
});

This will only run once the whole page is loaded.

<html>
<head>
<script type="text/javascript">
function sortFunction() {
//logic
}
</script>
</head>
<body onload="sortFunction()">
<select name="sort" style="vertical-align:middle;" id="cboSort">
    <option value="1" selected="selected">Low to High</option>
    <option value="2">High to Low</option>
</select>
</body>
</html>

try that, the other answer works too

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top