0

I have old jQuery code which I rewriting in javascript for a Vue.js application.

function DisableSubmit() {
    submitButton.prop('disabled', true);
    submitButton.attr('data-enabled-value', submitButton.val());
    submitButton.val('WORKING...');
    jQuery(config.formName + ' .spinner-container.fullscreen').show();
  }

This is the corresponding html

<div class="col-xs-3" style="float: right;"><span><input aria-label="Submit"
                            class="SubmitButton" href="#" id="register"
                            name="Submit" style="color: #fff; padding: 1rem; background-color: #c8102e;" type="submit"
                            value="Submit" /> </span>

                    <div class="clearfix"></div>

                    <p class="require center" style="color: #fff; margin-left: 1rem;">*Required</p>
                </div>

My question is what will be best approach towards this.

Also, I am exactly sure if we have replacements for .prop() and .attr() in javascript

1

1 Answer 1

0

Typically, you wouldn't manipulate DOM elements but rather your vue component's state and then bind that state to the DOM.

You'll want to

Here's a working example: https://codesandbox.io/s/stack-overflow-q-59026962-onb7j. I left out the spinner toggle & removed some markup for clarity.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.