Welcome Guest, Not a member yet? Register   Sign In
enable / disable button based on record inserted
#1

I want to insert images into my db. once images uploaded view button, delete button to be enabled.
i try with anchor but 
Code:
<td align="center">
<a href="<?php echo base_url().'Users/deleteFile/'.$row['markid']; ?>"  name="idv"
 <i class="fa fa-remove" style="font-size:25px;color:red"></i>
</td>

Code:
<td align="center">
<a href="<?php echo base_url().'Users/viewfile/'.$row['markid']; ?>"  name="idv"
 <i class="fa fa-view" style="font-size:25px;color:red"></i>
</td>

how to solve this?
Reply
#2

Code:
DOM:
---------------------------------------------------

document.getElementById("myBtn").disabled = true;

buttonObject.disabled = true|false

JavaScript:
---------------------------------------------------

<div class="click">Click me to Disable/Enable a html button</div>
<div class="showup">
   <input id="Button" type="button" value=" + " style="background-color:grey" />
</div>

// Demo using plain javascript
var button   = document.getElementById("Button");
var clickBtn = document.getElementsByClassName('click')[0];

// Disable the button on initial page load
button.disabled = true;

//add event listener
clickBtn.addEventListener('click', function(event) {
   button.disabled = !button.disabled;
});

button.addEventListener('click', function(event) {
   alert('Enabled!');
});


CSS:
---------------------------------------------------

.showup {
   width: 100px;
   height: 100px;
}

.click {
   cursor: pointer;
   padding-bottom: 10px;
}

Try one of those
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

First of all, your <a> tags aren't closed with </a>.
Question: Do you use AJAX to upload the images?
Reply
#4

(09-18-2018, 12:41 PM)Wouter60 Wrote: First of all, your <a> tags aren't closed with </a>.
Question: Do you use AJAX to upload the images?

yes i am using a ajax in a pop up window.
Reply
#5

Quote:yes i am using a ajax in a pop up window.

Make sure the buttons are disabled by default.
In the success part of your AJAX routine, enable the buttons. If you give both buttons the same css class, you can enable them in jQuery by removing the disabled property:
Code:
$('.image-action').prop('disabled', false);  //this will enable all elements with the "image-action" class.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB