Using Jquery to read text, but still clickable
Sample code:
jQuery(document).ready(function($) {
//Make upload link readonly
if( $( '#uploads_link' ).length > 0 ) {
$( '#uploads_link' ).attr( 'readonly', 'readonly' );
}
});
I'm trying to figure out how to store the uploads_link url that the user sees as read-only, but make it "interactive". Right now the user can see the url link and copy and paste it, but now I am trying to figure out how to make the readonly url clickable.
Any suggestions on how to make the attr ('readonly', 'readonly') tag clickable?
+3
source to share
1 answer
Try the following:
$(document).ready(function () {
$('#txt').click(function () {
console.log('OK');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="txt" type="text" readonly>
+2
source to share