javascript - Jquery ID selector when attribute name has a hash -


i'm running problem, our internal framework has system if have form & containing element name starts hash-tag when processing these elements later on.

so have instance :

<label width='auto' for='x_test' >test:</label>     <input type="checkbox" name="#x_test#" id="x_test" value="1"  /> 

now using jquery if want select input, instance hide it:

$( "#x_test" ).hide(); 

this not work unless remove hashtags name of element. i'm doing select id i'm not sure why such issue.

is known issue & there can do?

we on jquery-1.3.2

thanks

update

thanks hints, helped me bit , did learn things them in end problem bad existing code else interfering trying do.

we have wizard en in each step copies inputs page hidden dynamic form wizard.

but copying id-attribute etc didn't respect rule of unique id's anymore. because of jquery / jquery ui , javascript behaving realy weird ofcourse. ended rewriting wizard-thing jquery etc work.

to select attribute:

$('[name="#x_test#"]').hide(); 

to select id:

$('#x_test').hide(); 

or

$('[id="x_test"]').hide(); 

check below code (with jquery 1.3.2).

the id selection applies green colour, instead name attribute selection applies red colur:

$('#test').css({'color':'green'});  $('[name="#test"]').css({'color':'red'});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>  <div id="test">test id</div>  <div name="#test">name test</div>


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -