Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable an onclick option in span?

I have this

 <span class="ui-icon ui-icon-info"  id="icon" runat="server"  ></span>

I dont use onclick but my icon is clickable (maybe because the jquery-ui class...) I need to disable the onclick completely.

Is there a way to do it?

like image 599
user2560521 Avatar asked Sep 21 '25 07:09

user2560521


2 Answers

You can try:

jQuery off() to off the onclick event for specific span.

Use:

jQuery( "span#icon" ).off("click");

Check w3schools tutorial for this

Or, You can try:

jQuery( "span#icon" ).css("cursor","default");

I guess the clicking on the span does not fire any event if not specified, means this is more a design issue

If there is a hand-cursor coming up as soon as you hover you can spcecify this by the cursor attribute in css:

.someclass {
   cursor: default
}

Another possibility if there is some event fireing as seen here: Use CSS to make a span not clickable

<span class='unclickable' onclick='return false;'>description<br></span>
like image 26
thilo.dev Avatar answered Sep 22 '25 21:09

thilo.dev