In my application I have a mark up like these
<div id="divLeft" style = " width: 300px; border: 1px solid red; float: left" onclick="DoThis('textId')">
<input type="text" id="textId" />
</div>
<div id="divRight" style = " width: 600px; border: 1px solid red; float: right" onclcick="DoThat()">
</div>
and in the java script event handler code I have to retrieve textId element for which i use the id selector as
function DoThis(id){
//some code goes here
$("#"+id).show();
//some code goes here
}
and there are hundreds of places where am doing string concatenation like “#”+somID, this looks bad to me. I wanted to know is there some way or jquery selector API like $.id(someID) or something which would avoid this string concatenation?
Regards,
Jeez
Create a wrapper: