Hulp bij jquery script

Status
Niet open voor verdere reacties.

VBMichael

Gebruiker
Lid geworden
16 jan 2010
Berichten
32
Ik zoek de juiste methode om alle input elementen te vinden welke een id hebben dat
begint met count_[0-9]+ of price_[0-9]+ of submission_[0-9]+. Daarvan als er een focusout wordt uitgevoerd dat ik dan de id ervan terug krijg. Mijn script heb ik hieronder gezet maar het werkt niet. Iemand die kan helpen?

[JS]
$(document).ready(function () {
$('input').attr('id').match('/^count_[0-9]+$|^price_[0-9]+$|^submission_[0-9]+$/').focusout(function () {
var currentID = $(this).attr('id');

alert('ID: ' + currentID);
});
});
[/JS]
 
Is opgelost heb het over een andere boeg gegooid, dit is de oplossing.

[JS]
var currentID;
var type;

$("input[id*=count_]").focusout(function () {
currentID = $(this).attr('id');
type = 'count';
Calculate();
});
$("input[id*=price_]").focusout(function () {
currentID = $(this).attr('id');
type = 'price';
Calculate();
});
$("input[id*=submission_]").focusout(function () {
currentID = $(this).attr('id');
type = 'submission';
Calculate();
});
[/JS]
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan