We help IT Professionals succeed at work.

jquery select all ids that start with

maqskywalker
maqskywalker asked
on
i'm using the jquery masked input plugin
http://digitalbush.com/projects/masked-input-plugin/

In my jquery code i currently set the date mask like this and it works fine:

$('#txtbox1').mask("99/99/9999");


On another page i have 3 textboxes.

The 3 textboxes on this page have these ids

txtboxEmployee_123
txtboxEmployee_135
txtboxEmployee_145

How do i revise this.
$('#txtbox1').mask("99/99/9999");

 So the mask gets applied to all textboxes with an id that starts with this txtboxEmployee_
Comment
Watch Question

Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
Something like this:

$('[id^=txtboxEmployee_]').mask("99/99/9999");

Open in new window