Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

special characters in id of html tags

Tags:

People also ask

Can HTML ID have special characters?

The HTML 4.01 spec states that ID tokens must begin with a letter ( [A-Za-z] ) and may be followed by any number of letters, digits ( [0-9] ), hyphens ( - ), underscores ( _ ), colons ( : ), and periods ( . ). For the class attribute, there is no such limitation.

What is the symbol for ID in HTML?

In Html for an element ID name starts with the “#” symbol followed by a unique name assigned to it. On the other hand class assigned to an element has its name starts with “.” followed by class name. Only one ID selector can be attached to an element.

Can HTML ID be a string?

For HTML 4, the answer is technically: ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

Can HTML element ID have spaces?

id 's value must not contain whitespace (spaces, tabs etc.). Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. In contrast to the class attribute, which allows space-separated values, elements can only have one single ID value.


In html code I am using code <input type = "text" id = "[email protected]"> to get text now it need to get its value which is entered in text field. I am using jquery to do that:

$( document ).ready( function() {     $( ".bid" ).click( function() {         idVal = this.id         bidID = "#" + idVal + "bid"         spanID = "#" + idVal + "cbid"         bidValue = $(bidID).val();          alert(idVal)         alert(bidID)         alert(bidValue) //this alert says undefined         $( spanID ).html( '&nbsp;' ).load( '{% url online_machines %}?id=' + idVal + '&bidvalue=' + bidValue);     }); }); 

By doing this i get the value error undefined. I tried to remove special characters from the id to get its value. But I need the id with special characters. How can I get its value using jquery ?