0

In HTML file, there are 3 buttons as save,edit and cancel. Im hiding save and edit button depends on the functionality in javascript.

<div class="controls col-sm-9">
    <button onclick="modJs.save();return false;" class="saveBtn btn btn-primary pull-right"><i class="fa fa-save"></i> <t>Save</t></button>
    <button onclick="modJs.editrecord();return false;" class="EditBtn btn btn-primary " style="display:none;"><i class="fa fa-save"></i> <t>Update</t></button>
    <button onclick="modJs.cancel();return false;" class="cancelBtn btn pull-right" style="margin-right:5px;"><i class="fa fa-times-circle-o"></i> <t>Cancel</t></button>
</div>

in my javascript fucntion, im showing and hiding edit and save buttons.

if(object != undefined && object != null) {   //editing selected
    $(".editBtn").show();
    $(".saveBtn").hide();
    this.fillForm(object);
}

Already i gave display:none in html tag for edit button. I want to show edit button if object is not null (that means edit). By the above code, the save button get hide, but edit button is not showing.

2
  • Its a typo .... your class is EditBtn and you are calling as editBtn Commented Sep 20, 2017 at 6:57
  • This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting. Commented Sep 20, 2017 at 6:58

2 Answers 2

6

I guess there is a little spelling mistake there

replace

$(".editBtn").show();

with

 $(".EditBtn").show();

Or maybe simply change classname EditBtn to editBtn to keep naming consistent.

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

Comments

2

In your HTML you're using the class EditBtn, in the JS code you use the class editBtn. Class names are case sensitive! Change it in the HTML to editBtn.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.