javascript - How can I prevent a user using inspect element to enable a disabled element? -
i have button follows:
<input type="submit" class="button" value="foobar" name="foobar" id="foobar" disabled="disabled">
i enabling button when parameters met. test whether secure, pressed f12 (or right click -> inspect element) , edited out text disabled="disabled". doing overrides code , scary. how can prevent changing in manner?
i using php , jquery in page , using latter enable or disable button. have checked jquery click function , not executes, shows button not disabled. alert below reads disabled: false
$("#foobar").click(function(){ alert('disabled: ' + $(this).is('[disabled=disabled]')); })
so how can prevent user changing button disabled state , overriding logic?
you can't stop people using dev tools.
you can try couple of tricks disable right clicking (like 1 below) stop number of people solution problem use html , http properly.
$(document).bind("contextmenu",function(e) { e.preventdefault(); });
Comments
Post a Comment