The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JQuery – Set default value (not from input form)

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #150279

    Hi there

    I’m trying to modify a jquery script. The standard is defined, that certain values are coming from a html form. I actually don’t like the form on the page and would like to set in the jquery file the default values. So all values are already set in the jquery also the values if a checkbox is checked or not.

    How can I define in there some default values? I am a newbie with jquery… I thought I just can add the values like this (which was not the correct solution):

    var numberOfBokehs = $("#nrOfOrbs").val('100'); -> (‘100’)

    function repaint() {
    // Retrieve all user submitted data
    var numberOfBokehs = $(“#nrOfOrbs”).val();
    var bokehMinSize = parseInt($(“#orbMin”).val());
    var bokehMaxSize = parseInt($(“#orbMax”).val());
    var orbColour = $(“#orbColour”).val();

    // Check if we need to create random colours
    var useRandomColours = false;
    if ( $(“#orbRandom”).is(“:checked”) ) {
    useRandomColours = true;

    // Check if we need to create gradients
    var useGradients = false;
    if ( $(“#orbGradient”).is(“:checked”) ) {
    useGradients = true;

    Thank you for your help… Peter

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.