html - Jquery select by class alternatives -


i have 2 html elements(span , input) represent same user property. in jquery script want select both elements. way found specify different ids , execute 2 queries

$("#span\\.firstname") $("#input\\.firstname").  

at moment looking solution. want use class attribute (specify class firstname on span , input , perform

$(".firstname") 

), css aren't ready , don't know classes required, can't use it. know, if exists other solution perform selection, class attribute.

<td>   <div>      <span id="span.firstname">${user.firstname}</span>      <span id="span.lastname">${user.lastname}</span>   </div>   <div>      <span>first name</span><input id="input.firstname" value="${user.firstname}"/>      <span>last name</span><input id="input.lastname" value="${user.lastname}"/>   </div> </td> 

you can selector so:

$("[id*='firstname']") // give both span , input of firstname etc 

official document


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -